Skip to content

Commit

Permalink
#1 - Fix: Update User Jwt
Browse files Browse the repository at this point in the history
  • Loading branch information
umtuk committed Jul 18, 2023
1 parent 1a39d14 commit 9a9b897
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@Builder
@Getter
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class UserJwtPayload {

private String baseUserId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
@AllArgsConstructor
@Builder
@Getter
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class UserJwtUnit {

private JwtUnit accessToken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public class UserJwtAuthenticationFilter extends OncePerRequestFilter {
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
FilterChain filterChain) throws ServletException, IOException {
String token = parseBearerToken(request);
log.info("{}", token);
if (token == null) {
filterChain.doFilter(request, response);
return;
Expand All @@ -64,7 +63,6 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
}

UserJwtPayload payload = userJwtService.getPayload(token);
log.info("{}", payload);
if (payload.getJwtType() != JwtType.ACCESS_TOKEN) {
throw roeFactory.get(
UserErrorCode.ROE_102,
Expand Down Expand Up @@ -92,6 +90,15 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
);
}

String refreshToken = userDetails.getRefreshToken();
if (refreshToken == null) {
throw roeFactory.get(
UserErrorCode.ROE_102,
UserJwtErrorDescription.INVALID_TOKEN,
HttpStatus.UNAUTHORIZED
);
}

request.setAttribute(USER_PAYLOAD, payload);
request.setAttribute(USER_DETAILS, userDetails);

Expand Down

0 comments on commit 9a9b897

Please sign in to comment.