Skip to content

Commit

Permalink
Test :: Logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jbj338033 committed May 26, 2024
1 parent e418344 commit be03996
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,23 @@ class AuthServiceImpl(
try {
jwtProvider.validateToken(request.refreshToken)
} catch (e: ExpiredJwtException) {
println("Expired Jwt Exception")
throw CustomException(ErrorCode.EXPIRED_REFRESH_TOKEN)
} catch (e: UnsupportedJwtException) {
println("Unsupported Jwt Exception")
throw CustomException(ErrorCode.UNSUPPORTED_REFRESH_TOKEN)
} catch (e: SecurityException) {
println("Security Exception")
throw CustomException(ErrorCode.INVALID_REFRESH_TOKEN)
} catch (e: IllegalArgumentException) {
println("Illegal Argument Exception")
throw CustomException(ErrorCode.INVALID_REFRESH_TOKEN)
}

if (jwtProvider.getType(request.refreshToken) != JwtType.REFRESH) throw CustomException(ErrorCode.INVALID_REFRESH_TOKEN)
if (jwtProvider.getType(request.refreshToken) != JwtType.REFRESH) {
println("Not Refresh Token")
throw CustomException(ErrorCode.INVALID_REFRESH_TOKEN)
}

val authentication = jwtProvider.getAuthentication(request.refreshToken)
val user = userRepository.findByEmail(authentication.name) ?: throw CustomException(ErrorCode.USER_NOT_FOUND)
Expand Down

0 comments on commit be03996

Please sign in to comment.