Skip to content

Commit

Permalink
[fix] 불필요한 로그 삭제 및 요청 정보 로깅 코드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
MinchoGreenT committed May 31, 2024
1 parent cc588c0 commit 24040f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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> claims = Jwts.parser().setSigningKey(secretKey).parseClaimsJws(token);
log.info("[validateToken] 토큰 유효 체크 완료");
return true;
Expand Down

0 comments on commit 24040f8

Please sign in to comment.