Skip to content

Commit

Permalink
refactor: 디렉토리 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
jemin committed Nov 26, 2023
1 parent ad93c16 commit 0de81f0
Show file tree
Hide file tree
Showing 59 changed files with 132 additions and 192 deletions.
3 changes: 2 additions & 1 deletion clients/client-auth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies {
implementation 'io.github.openfeign:feign-hc5' // Open Feign의 클라이언트로 Apache HttpClient5를 사용합니다

// Fault Tolerance
implementation 'org.springframework.cloud:spring-cloud-starter-circuitbreaker-resilience4j'


// JWT
implementation 'io.jsonwebtoken:jjwt-api:0.11.2'
Expand All @@ -24,3 +24,4 @@ dependencies {

testImplementation "org.springframework.cloud:spring-cloud-starter-contract-stub-runner"
}

48 changes: 24 additions & 24 deletions clients/client-auth/src/main/resources/client-auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@ spring.cloud.openfeign:
max-connections: 2000 # 전체 커넥션 수
max-connections-per-route: 500 # Route당 할당되는 최대 커넥션 수

circuitbreaker:
enabled: true

resilience4j.circuitbreaker:
configs:
default:
slidingWindowType: COUNT_BASED
minimumNumberOfCalls: 3 # Circuit Open 여부를 판단하기 위해 실행해야 하는 최소 요청 횟수
slidingWindowSize: 5 # Circuit Open 여부를 체크하는 윈도우 크기
waitDurationInOpenState: 5s # Circuit이 Open 상태에 머무는 시간

failureRateThreshold: 80 # 슬라이딩 윈도우 내에서 몇 %이상되면 Circuit을 Open할지 결정하는 비율

slowCallDurationThreshold: 2000 # 몇초동안 요청이 지속되면 슬로우 콜로 판별되는지 기준
slowCallRateThreshold: 80 # 슬라이딩 윈도우 내 요청 중 몇 %이상 슬로우 콜이 발생하면 Circuit을 Open할지 결정하는 비율

permittedNumberOfCallsInHalfOpenState: 5 # Half Open 상태에서 상태 변화를 위해 테스트 해보는 요청 횟수
automaticTransitionFromOpenToHalfOpenEnabled: true # Half Open으로 자동으로 변경시킬지 여부

eventConsumerBufferSize: 10 # Actuator에서 CircuitBreaker 상태를 보여줄때 이벤트를 몇개까지 버퍼에 쌓을지 결정

instances:
default: # Circuit Breaker 인스턴스 이름
baseConfig: default # 어떤 설정을 사용할지 결정. default라면 상단의 default config를 그대로 사용함
# circuitbreaker:
# enabled: true
#
#resilience4j.circuitbreaker:
# configs:
# default:
# slidingWindowType: COUNT_BASED
# minimumNumberOfCalls: 3 # Circuit Open 여부를 판단하기 위해 실행해야 하는 최소 요청 횟수
# slidingWindowSize: 5 # Circuit Open 여부를 체크하는 윈도우 크기
# waitDurationInOpenState: 5s # Circuit이 Open 상태에 머무는 시간
#
# failureRateThreshold: 80 # 슬라이딩 윈도우 내에서 몇 %이상되면 Circuit을 Open할지 결정하는 비율
#
# slowCallDurationThreshold: 2000 # 몇초동안 요청이 지속되면 슬로우 콜로 판별되는지 기준
# slowCallRateThreshold: 80 # 슬라이딩 윈도우 내 요청 중 몇 %이상 슬로우 콜이 발생하면 Circuit을 Open할지 결정하는 비율
#
# permittedNumberOfCallsInHalfOpenState: 5 # Half Open 상태에서 상태 변화를 위해 테스트 해보는 요청 횟수
# automaticTransitionFromOpenToHalfOpenEnabled: true # Half Open으로 자동으로 변경시킬지 여부
#
# eventConsumerBufferSize: 10 # Actuator에서 CircuitBreaker 상태를 보여줄때 이벤트를 몇개까지 버퍼에 쌓을지 결정
#
# instances:
# default: # Circuit Breaker 인스턴스 이름
# baseConfig: default # 어떤 설정을 사용할지 결정. default라면 상단의 default config를 그대로 사용함
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package cmc.mellyserver.auth.certificate;

public abstract class CertificateConstants {

public static final String TITLE_CERTIFICATION = "Melly 인증번호 안내";

public static final String PREFIX_CERTIFICATION = "email certification:";

public static final int LIMIT_TIME_CERTIFICATION_NUMBER = 60 * 3;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmc.mellyserver.common.event;
package cmc.mellyserver.auth.certificate;

public record CertificationCompletedEvent(String email, String content) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cmc.mellyserver.auth.certificate;

import static cmc.mellyserver.mail.EmailConstants.*;
import static cmc.mellyserver.auth.certificate.CertificateConstants.*;

import java.time.Duration;

Expand All @@ -15,9 +15,7 @@ class CertificationNumberRepository {

private final StringRedisTemplate redisTemplate;

/*
인증번호 유효기간 : 3분
*/
// 인증번호 유효기간 : 3분
public void save(String email, String certificationNumber) {

redisTemplate.opsForValue()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cmc.mellyserver.auth.certificate;

import cmc.mellyserver.auth.dto.request.EmailCertificationRequest;
import cmc.mellyserver.auth.service.dto.request.EmailCertificationRequest;

public interface CertificationService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Repository;

import cmc.mellyserver.auth.dto.request.EmailCertificationRequest;
import cmc.mellyserver.common.event.CertificationCompletedEvent;
import cmc.mellyserver.auth.service.dto.request.EmailCertificationRequest;
import lombok.RequiredArgsConstructor;

@Profile({"local", "prod"})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package cmc.mellyserver.auth.common.constant;

public abstract class AuthConstants {

public static final String SIGNUP_CELEBRATION_MAIL = "회원가입 축하드립니다!";
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import org.springframework.util.StringUtils;
import org.springframework.web.filter.OncePerRequestFilter;

import cmc.mellyserver.auth.common.util.HeaderUtil;
import cmc.mellyserver.auth.token.TokenProvider;
import cmc.mellyserver.common.util.HeaderUtil;
import cmc.mellyserver.support.exception.LogoutOrWithdrawException;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;

import cmc.mellyserver.auth.common.util.HeaderUtil;
import cmc.mellyserver.auth.token.TokenProvider;
import cmc.mellyserver.common.util.HeaderUtil;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmc.mellyserver.common.util;
package cmc.mellyserver.auth.common.util;

import java.util.Objects;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
import cmc.mellyserver.auth.certificate.CertificationService;
import cmc.mellyserver.auth.common.resolver.CurrentUser;
import cmc.mellyserver.auth.common.resolver.LoginUser;
import cmc.mellyserver.auth.common.util.HeaderUtil;
import cmc.mellyserver.auth.controller.dto.request.AuthLoginRequest;
import cmc.mellyserver.auth.controller.dto.request.ChangePasswordRequest;
import cmc.mellyserver.auth.controller.dto.request.OAuthLoginRequest;
import cmc.mellyserver.auth.controller.dto.request.OAuthSignupRequest;
import cmc.mellyserver.auth.controller.dto.request.ReIssueAccessTokenRequest;
import cmc.mellyserver.auth.controller.dto.request.SignupRequest;
import cmc.mellyserver.auth.dto.request.EmailCertificationRequest;
import cmc.mellyserver.auth.dto.response.OAuthResponseDto;
import cmc.mellyserver.auth.dto.response.TokenResponseDto;
import cmc.mellyserver.auth.service.AuthService;
import cmc.mellyserver.auth.service.OAuthService;
import cmc.mellyserver.common.util.HeaderUtil;
import cmc.mellyserver.auth.service.dto.request.EmailCertificationRequest;
import cmc.mellyserver.auth.service.dto.response.OAuthResponseDto;
import cmc.mellyserver.auth.service.dto.response.TokenResponseDto;
import cmc.mellyserver.support.response.ApiResponse;
import cmc.mellyserver.support.response.SuccessCode;
import jakarta.servlet.http.HttpServletRequest;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cmc.mellyserver.auth.controller.dto.request;

import cmc.mellyserver.auth.dto.request.AuthLoginRequestDto;
import cmc.mellyserver.auth.service.dto.request.AuthLoginRequestDto;
import jakarta.validation.constraints.Email;

public record AuthLoginRequest(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cmc.mellyserver.auth.controller.dto.request;

import cmc.mellyserver.auth.dto.request.OAuthLoginRequestDto;
import cmc.mellyserver.auth.service.dto.request.OAuthLoginRequestDto;
import cmc.mellyserver.dbcore.user.enums.Provider;
import lombok.Builder;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.hibernate.validator.constraints.Length;

import cmc.mellyserver.auth.dto.request.OAuthSignupRequestDto;
import cmc.mellyserver.auth.service.dto.request.OAuthSignupRequestDto;
import cmc.mellyserver.dbcore.user.enums.AgeGroup;
import cmc.mellyserver.dbcore.user.enums.Gender;
import cmc.mellyserver.dbcore.user.enums.Provider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.hibernate.validator.constraints.Length;

import cmc.mellyserver.auth.dto.request.AuthSignupRequestDto;
import cmc.mellyserver.auth.service.dto.request.AuthSignupRequestDto;
import cmc.mellyserver.dbcore.user.enums.AgeGroup;
import cmc.mellyserver.dbcore.user.enums.Gender;
import jakarta.validation.constraints.Email;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import org.springframework.transaction.annotation.Transactional;

import cmc.mellyserver.auth.controller.dto.request.ChangePasswordRequest;
import cmc.mellyserver.auth.dto.request.AuthLoginRequestDto;
import cmc.mellyserver.auth.dto.request.AuthSignupRequestDto;
import cmc.mellyserver.auth.dto.response.TokenResponseDto;
import cmc.mellyserver.auth.service.dto.request.AuthLoginRequestDto;
import cmc.mellyserver.auth.service.dto.request.AuthSignupRequestDto;
import cmc.mellyserver.auth.service.dto.response.TokenResponseDto;
import cmc.mellyserver.auth.token.RefreshToken;
import cmc.mellyserver.auth.token.TokenDto;
import cmc.mellyserver.auth.token.TokenService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cmc.mellyserver.auth.dto.request.OAuthLoginRequestDto;
import cmc.mellyserver.auth.dto.request.OAuthSignupRequestDto;
import cmc.mellyserver.auth.dto.response.OAuthResponseDto;
import cmc.mellyserver.auth.dto.response.TokenResponseDto;
import cmc.mellyserver.auth.service.dto.request.OAuthLoginRequestDto;
import cmc.mellyserver.auth.service.dto.request.OAuthSignupRequestDto;
import cmc.mellyserver.auth.service.dto.response.OAuthResponseDto;
import cmc.mellyserver.auth.service.dto.response.TokenResponseDto;
import cmc.mellyserver.auth.token.TokenDto;
import cmc.mellyserver.auth.token.TokenService;
import cmc.mellyserver.clientauth.LoginClient;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmc.mellyserver.auth.dto.request;
package cmc.mellyserver.auth.service.dto.request;

import lombok.Builder;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmc.mellyserver.auth.dto.request;
package cmc.mellyserver.auth.service.dto.request;

import org.hibernate.validator.constraints.Length;

Expand Down Expand Up @@ -35,7 +35,7 @@ public record AuthSignupRequestDto(
public User toEntity() {
return User.builder()
.email(email)
.password("passowrd")
.password(password)
.nickname(nickname)
.ageGroup(ageGroup)
.gender(gender)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmc.mellyserver.auth.dto.request;
package cmc.mellyserver.auth.service.dto.request;

public record EmailCertificationRequest(String email, String certificationNumber) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmc.mellyserver.auth.dto.request;
package cmc.mellyserver.auth.service.dto.request;

import cmc.mellyserver.dbcore.user.enums.Provider;
import lombok.Builder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmc.mellyserver.auth.dto.request;
package cmc.mellyserver.auth.service.dto.request;

import cmc.mellyserver.dbcore.user.User;
import cmc.mellyserver.dbcore.user.enums.AgeGroup;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmc.mellyserver.auth.dto.response;
package cmc.mellyserver.auth.service.dto.response;

import cmc.mellyserver.dbcore.user.enums.UserStatus;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmc.mellyserver.auth.dto.response;
package cmc.mellyserver.auth.service.dto.response;

public record OAuthResponseDto(TokenResponseDto tokenInfo, OAuthSignupResponseDto data) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmc.mellyserver.auth.dto.response;
package cmc.mellyserver.auth.service.dto.response;

public record OAuthSignupResponseDto(String socialId, String provider) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmc.mellyserver.auth.dto.response;
package cmc.mellyserver.auth.service.dto.response;

public record RefreshTokenDto(String token, long expiredAt) {
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmc.mellyserver.auth.dto.response;
package cmc.mellyserver.auth.service.dto.response;

public record TokenResponseDto(String accessToken, String refreshToken) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component;

import cmc.mellyserver.auth.dto.response.RefreshTokenDto;
import cmc.mellyserver.auth.service.dto.response.RefreshTokenDto;
import cmc.mellyserver.dbcore.user.enums.RoleType;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.ExpiredJwtException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cmc.mellyserver.auth.token;

import cmc.mellyserver.auth.dto.response.RefreshTokenDto;
import cmc.mellyserver.auth.service.dto.response.RefreshTokenDto;

public record TokenDto(String accessToken, RefreshTokenDto refreshToken) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.springframework.security.core.Authentication;

import cmc.mellyserver.auth.dto.response.RefreshTokenDto;
import cmc.mellyserver.auth.service.dto.response.RefreshTokenDto;
import cmc.mellyserver.dbcore.user.enums.RoleType;

public interface TokenProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.springframework.stereotype.Component;

import cmc.mellyserver.auth.dto.response.RefreshTokenDto;
import cmc.mellyserver.auth.service.dto.response.RefreshTokenDto;
import cmc.mellyserver.dbcore.user.User;
import cmc.mellyserver.support.exception.BusinessException;
import cmc.mellyserver.support.exception.ErrorCode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmc.mellyserver.common.aop.lock.annotation;
package cmc.mellyserver.common.aspect.lock;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmc.mellyserver.common.aop.lock;
package cmc.mellyserver.common.aspect.lock;

import java.lang.reflect.Method;

Expand All @@ -10,7 +10,6 @@
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Component;

import cmc.mellyserver.common.aop.lock.annotation.DistributedLock;
import cmc.mellyserver.support.exception.BusinessException;
import cmc.mellyserver.support.exception.ErrorCode;
import lombok.RequiredArgsConstructor;
Expand All @@ -22,7 +21,7 @@ public class DistributedLockAop {

private final RedissonClient redissonClient;

@Around("@annotation(cmc.mellyserver.common.aop.lock.annotation.DistributedLock)")
@Around("@annotation(cmc.mellyserver.common.aspect.lock.DistributedLock)")
public Object lock(final ProceedingJoinPoint joinPoint) throws Throwable {

MethodSignature signature = (MethodSignature)joinPoint.getSignature();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmc.mellyserver.common.aop.lock;
package cmc.mellyserver.common.aspect.lock;

import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cmc.mellyserver.common.aop.place;
package cmc.mellyserver.common.aspect.place;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
Expand All @@ -7,6 +7,6 @@

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ValidatePlaceExisted {
public @interface CheckPlaceExist {

}
Loading

0 comments on commit 0de81f0

Please sign in to comment.