Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,19 @@ public ResponseEntity<Void> quit(

@PostMapping("/reissue")
public ResponseEntity<ReissueResponse> reissueToken(
HttpServletRequest request
HttpServletRequest request,
HttpServletResponse response
) {
String refreshToken = refreshTokenCookieManager.getRefreshToken(request);
ReissueResponse reissueResponse = authService.reissue(refreshToken);
return ResponseEntity.ok(reissueResponse);
try {
ReissueResponse reissueResponse = authService.reissue(refreshToken);
return ResponseEntity.ok(reissueResponse);
} catch (CustomException e) {
if (e.getErrorCode().equals(ErrorCode.REFRESH_TOKEN_EXPIRED)) {
refreshTokenCookieManager.deleteCookie(response);
}
throw e;
}
}

private String getAccessToken(Authentication authentication) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@
@Getter
public class CustomException extends RuntimeException {

private final ErrorCode errorCode;
private final int code;
private final String message;

public CustomException(ErrorCode errorCode) {
code = errorCode.getCode();
message = errorCode.getMessage();
this.errorCode = errorCode;
this.code = errorCode.getCode();
this.message = errorCode.getMessage();
}

public CustomException(ErrorCode errorCode, String detail) {
code = errorCode.getCode();
message = errorCode.getMessage() + " : " + detail;
this.errorCode = errorCode;
this.code = errorCode.getCode();
this.message = errorCode.getMessage() + " : " + detail;
}
}
Loading