generated from pricelees/issue-pr-template
refactor: JwtHandler에서의 빈 토큰값 예외 처리 추가
This commit is contained in:
parent
357f53deb4
commit
95e952c215
@ -37,6 +37,8 @@ class JwtHandler(
|
|||||||
.body
|
.body
|
||||||
.get(MEMBER_ID_CLAIM_KEY, Number::class.java)
|
.get(MEMBER_ID_CLAIM_KEY, Number::class.java)
|
||||||
.toLong()
|
.toLong()
|
||||||
|
} catch (_: IllegalArgumentException) {
|
||||||
|
throw AuthException(AuthErrorCode.TOKEN_NOT_FOUND)
|
||||||
} catch (_: ExpiredJwtException) {
|
} catch (_: ExpiredJwtException) {
|
||||||
throw AuthException(AuthErrorCode.EXPIRED_TOKEN)
|
throw AuthException(AuthErrorCode.EXPIRED_TOKEN)
|
||||||
} catch (_: Exception) {
|
} catch (_: Exception) {
|
||||||
|
|||||||
@ -41,7 +41,7 @@ class JwtHandlerTest : FunSpec({
|
|||||||
test("토큰이 빈 값이면 예외를 던진다.") {
|
test("토큰이 빈 값이면 예외를 던진다.") {
|
||||||
shouldThrow<AuthException> {
|
shouldThrow<AuthException> {
|
||||||
jwtHandler.getMemberIdFromToken("")
|
jwtHandler.getMemberIdFromToken("")
|
||||||
}.errorCode shouldBe AuthErrorCode.INVALID_TOKEN
|
}.errorCode shouldBe AuthErrorCode.TOKEN_NOT_FOUND
|
||||||
}
|
}
|
||||||
|
|
||||||
test("시크릿 키가 잘못된 경우 예외를 던진다.") {
|
test("시크릿 키가 잘못된 경우 예외를 던진다.") {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user