diff --git a/src/main/java/codesquad/fineants/global/common/authorized/AuthorizationAspect.java b/src/main/java/codesquad/fineants/global/common/authorized/AuthorizationAspect.java index 2460aff19..d396260e1 100644 --- a/src/main/java/codesquad/fineants/global/common/authorized/AuthorizationAspect.java +++ b/src/main/java/codesquad/fineants/global/common/authorized/AuthorizationAspect.java @@ -14,7 +14,7 @@ import org.springframework.stereotype.Component; import codesquad.fineants.global.common.authorized.service.AuthorizedService; -import codesquad.fineants.global.common.resource.ResourceIdAspect; +import codesquad.fineants.global.common.resource.ResourceIdParser; import codesquad.fineants.global.errors.errorcode.MemberErrorCode; import codesquad.fineants.global.errors.exception.FineAntsException; import codesquad.fineants.global.errors.exception.ForBiddenException; @@ -30,7 +30,7 @@ public class AuthorizationAspect { private final ApplicationContext applicationContext; - private final ResourceIdAspect resourceIdAspect; + private final ResourceIdParser resourceIdParser; @Before(value = "@annotation(authorized) && args(..)") public void validatePortfolioAuthorization(JoinPoint joinPoint, Authorized authorized) { @@ -51,7 +51,7 @@ public void validatePortfolioAuthorization(JoinPoint joinPoint, Authorized autho private List getResourceId(ProceedingJoinPoint joinPoint) { try { - return resourceIdAspect.around(joinPoint); + return resourceIdParser.getResourceList(joinPoint); } catch (Throwable e) { log.error(e.getMessage()); return Collections.emptyList(); diff --git a/src/main/java/codesquad/fineants/global/common/resource/ResourceIdAspect.java b/src/main/java/codesquad/fineants/global/common/resource/ResourceIdParser.java similarity index 80% rename from src/main/java/codesquad/fineants/global/common/resource/ResourceIdAspect.java rename to src/main/java/codesquad/fineants/global/common/resource/ResourceIdParser.java index bc195f1a3..0ef94e919 100644 --- a/src/main/java/codesquad/fineants/global/common/resource/ResourceIdAspect.java +++ b/src/main/java/codesquad/fineants/global/common/resource/ResourceIdParser.java @@ -5,19 +5,15 @@ import java.util.List; import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.Around; -import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.stereotype.Component; import lombok.extern.slf4j.Slf4j; -@Aspect @Component @Slf4j -public class ResourceIdAspect { - @Around("@annotation(org.springframework.web.bind.annotation.RequestMapping)") - public List around(ProceedingJoinPoint joinPoint) throws Throwable { +public class ResourceIdParser { + public List getResourceList(ProceedingJoinPoint joinPoint) { MethodSignature methodSignature = (MethodSignature)joinPoint.getSignature(); Annotation[][] parameterAnnotations = methodSignature.getMethod().getParameterAnnotations(); Object[] args = joinPoint.getArgs(); diff --git a/src/main/java/codesquad/fineants/global/security/ajax/entrypoint/CommonLoginAuthenticationEntryPoint.java b/src/main/java/codesquad/fineants/global/security/ajax/entrypoint/CommonLoginAuthenticationEntryPoint.java index 96dc66806..b94477a64 100644 --- a/src/main/java/codesquad/fineants/global/security/ajax/entrypoint/CommonLoginAuthenticationEntryPoint.java +++ b/src/main/java/codesquad/fineants/global/security/ajax/entrypoint/CommonLoginAuthenticationEntryPoint.java @@ -25,7 +25,6 @@ public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException { log.error("requestUrl : {}", request.getRequestURL()); log.error("AuthenticationEntryPoint : {}", exception.getMessage()); - exception.printStackTrace(System.out); MemberErrorCode errorCode = MemberErrorCode.UNAUTHORIZED_MEMBER; ApiResponse body = ApiResponse.error(errorCode); response.setStatus(errorCode.getHttpStatus().value());