diff --git a/apiGateway-service/src/main/java/com/waither/apigatewayservice/filter/AuthorizationHeaderFilter.java b/apiGateway-service/src/main/java/com/waither/apigatewayservice/filter/AuthorizationHeaderFilter.java index 129d79f8..ee2117e0 100644 --- a/apiGateway-service/src/main/java/com/waither/apigatewayservice/filter/AuthorizationHeaderFilter.java +++ b/apiGateway-service/src/main/java/com/waither/apigatewayservice/filter/AuthorizationHeaderFilter.java @@ -82,7 +82,7 @@ public GatewayFilter apply(Config config) { // Mono(단일 값), Flux(다중 값) -> Spring WebFlux private Mono onError(ServerWebExchange exchange, String errorMsg) { - log.error(errorMsg); + log.error("[*] Gateway filter error: {}", errorMsg); ServerHttpResponse response = exchange.getResponse(); response.setStatusCode(HttpStatus.UNAUTHORIZED); diff --git a/user-service/src/main/java/com/waither/userservice/global/annotation/AuthUserArgumentResolver.java b/user-service/src/main/java/com/waither/userservice/global/annotation/AuthUserArgumentResolver.java index 3d82dbe8..23d27fc5 100644 --- a/user-service/src/main/java/com/waither/userservice/global/annotation/AuthUserArgumentResolver.java +++ b/user-service/src/main/java/com/waither/userservice/global/annotation/AuthUserArgumentResolver.java @@ -3,7 +3,6 @@ import com.waither.userservice.entity.User; import com.waither.userservice.global.jwt.execption.SecurityCustomException; import com.waither.userservice.global.jwt.execption.SecurityErrorCode; -import com.waither.userservice.global.jwt.util.JwtUtil; import com.waither.userservice.repository.UserRepository; import jakarta.servlet.http.HttpServletRequest; import org.springframework.core.MethodParameter; @@ -23,7 +22,6 @@ @Transactional public class AuthUserArgumentResolver implements HandlerMethodArgumentResolver { - private final JwtUtil jwtUtil; private final UserRepository userRepository; @Override @@ -37,10 +35,11 @@ public boolean supportsParameter(MethodParameter parameter) { public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) { HttpServletRequest httpServletRequest = (HttpServletRequest) webRequest.getNativeRequest(); - String token = jwtUtil.resolveAccessToken(httpServletRequest); - String email = jwtUtil.getEmail(token); + String email = httpServletRequest.getHeader("email"); + + log.info("[*] Header from ApiGateway: {}", email); return userRepository.findByEmail(email) - .orElseThrow(() -> new SecurityCustomException(SecurityErrorCode.TOKEN_NOT_FOUND)); + .orElseThrow(() -> new SecurityCustomException(SecurityErrorCode.USER_NOT_FOUND)); } -} +} \ No newline at end of file