Skip to content

Commit

Permalink
Merge pull request #21 from Kusitms-29th-Meetup-TeamE/feat/20/oauth
Browse files Browse the repository at this point in the history
Fix: jwt 토큰 null 예외처리
  • Loading branch information
nohy6630 authored May 7, 2024
2 parents c61b830 + f5b5c02 commit 82040d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
"/users/main",
"/swagger-ui/**",
"/swagger-resources/**",
"/v3/api-docs/**").permitAll()
"/v3/api-docs/**",
"/healths").permitAll()
.anyRequest().authenticated())
.addFilterBefore(jwtFilter, ExceptionTranslationFilter.class)
.cors(c -> c.configurationSource(request -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public class JwtFilter extends OncePerRequestFilter {

@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
if (request.getHeader(AUTHORIZATION) == null) {
filterChain.doFilter(request, response);
return;
}
final String accessToken = getAccessTokenFromHttpServletRequest(request);
jwtProvider.validateAccessToken(accessToken);
final Long userId = jwtProvider.getSubject(accessToken);
Expand Down

0 comments on commit 82040d8

Please sign in to comment.