From 24040f82dbec60d1eb498c18668fee0a52ea1662 Mon Sep 17 00:00:00 2001 From: MinchoGreenT Date: Sat, 1 Jun 2024 03:48:06 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=EC=82=AD=EC=A0=9C=20=EB=B0=8F=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=20=EC=A0=95=EB=B3=B4=20=EB=A1=9C=EA=B9=85=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/common/security/JwtAuthenticationFilter.java | 5 ++--- .../global/common/security/JwtTokenProvider.java | 8 +------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/modernfarmer/farmusspring/global/common/security/JwtAuthenticationFilter.java b/src/main/java/com/modernfarmer/farmusspring/global/common/security/JwtAuthenticationFilter.java index a7b4ca19..1509b8a5 100644 --- a/src/main/java/com/modernfarmer/farmusspring/global/common/security/JwtAuthenticationFilter.java +++ b/src/main/java/com/modernfarmer/farmusspring/global/common/security/JwtAuthenticationFilter.java @@ -38,17 +38,16 @@ protected void doFilterInternal(HttpServletRequest servletRequest, HttpServletResponse servletResponse, FilterChain filterChain) { try { + log.info("Request method: {}", servletRequest.getMethod()); + log.info("Request path: {}", servletRequest.getRequestURI()); String token = jwtTokenProvider.getToken(servletRequest); if (token != null) { jwtTokenProvider.validateToken(token); - log.info(String.valueOf(1)); Authentication authentication = jwtTokenProvider.getAuthentication(token); - log.info(String.valueOf(2)); SecurityContextHolder.getContext().setAuthentication(authentication); - log.info(String.valueOf(3)); } }catch (IllegalArgumentException e) { // 예외 처리: Invalid access token header diff --git a/src/main/java/com/modernfarmer/farmusspring/global/common/security/JwtTokenProvider.java b/src/main/java/com/modernfarmer/farmusspring/global/common/security/JwtTokenProvider.java index 11934cf5..7f094875 100644 --- a/src/main/java/com/modernfarmer/farmusspring/global/common/security/JwtTokenProvider.java +++ b/src/main/java/com/modernfarmer/farmusspring/global/common/security/JwtTokenProvider.java @@ -109,19 +109,13 @@ public String getSocialToken(HttpServletRequest request) { } public Long getUserId(String token) { - log.info("[resolveToken] HTTP 헤더에서 Token 값 추출"); - String info = Jwts.parser().setSigningKey(secretKey).parseClaimsJws(token).getBody() .getSubject(); - Long userId = Long.valueOf(info); - - return userId; - + return Long.valueOf(info); } public boolean validateToken(String token) { // 토큰 유효성 확인 - log.info("[validateToken] 토큰 유효 체크 시작"); Jws claims = Jwts.parser().setSigningKey(secretKey).parseClaimsJws(token); log.info("[validateToken] 토큰 유효 체크 완료"); return true;