Skip to content

Commit

Permalink
refactor: JwtAuthenticationFilter 불필요한 로직 제거 (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
choidongkuen committed Feb 12, 2024
1 parent 13d2877 commit 40fd56b
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.springframework.security.authentication.InsufficientAuthenticationException;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.filter.OncePerRequestFilter;

Expand All @@ -31,7 +30,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
private final JwtProperty jwtProperty;

@Override
protected void doFilterInternal(HttpServletRequest request,
public void doFilterInternal(HttpServletRequest request,
HttpServletResponse response,
FilterChain filterChain) throws ServletException, IOException {
if (request.getMethod().equals("OPTIONS")) {
Expand Down Expand Up @@ -73,10 +72,9 @@ private void saveUserAuthentication(User user) {

private String resolveTokenFromRequest(HttpServletRequest request) {
String token = request.getHeader(jwtProperty.getAccess().getHeader());
if (!ObjectUtils.isEmpty(token) && token.toLowerCase().startsWith(jwtProperty.getBearer().toLowerCase())) {
if (token.toLowerCase().startsWith(jwtProperty.getBearer().toLowerCase())) {
return token.substring(7);
}
setRequestAttribute(request, "요청에 대한 JWT 파싱 과정에서 문제가 발생했습니다.");
return null;
}

Expand Down

0 comments on commit 40fd56b

Please sign in to comment.