Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/moidot/backend
Browse files Browse the repository at this point in the history
  • Loading branch information
yujung7768903 committed Oct 1, 2024
2 parents b5c8c5f + 5e7ab00 commit 6fab019
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/main/java/com/moim/backend/global/auth/LoginInterceptor.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.moim.backend.global.auth;

import com.moim.backend.global.auth.jwt.JwtService;
import com.moim.backend.global.common.Result;
import com.moim.backend.global.common.exception.CustomException;
import io.jsonwebtoken.ExpiredJwtException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
Expand All @@ -27,12 +30,8 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons

String authorization = request.getHeader(AUTHORIZATION);
if (authorization != null) {
try {
String token = jwtService.getToken(Optional.of(authorization));
jwtService.validateToken(token);
} catch (Exception e) {
return false;
}
String token = jwtService.getToken(Optional.of(authorization));
jwtService.validateToken(token);
}

return true;
Expand Down

0 comments on commit 6fab019

Please sign in to comment.