This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
[BE] refactor: 예외 메시지 포맷 수정 #263
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2d7d596
feat: 예외 메시지 포맷 수정
HubCreator de928c2
refactor: 에 키워드 추가
HubCreator 3a993c1
[FE] feat: 글 삭제 기능 구현 (#245)
jeonjeunghoon 9dbeffa
[FE] feat: 글 제목 수정 기능 구현, 파일 업로드 용량 제한 (#243)
nangkyeonglim d6b45f4
[BE] feat: 기존 `Block Entity` 삭제 및 `Content` -> `Block`으로 변경 (#247)
9fe901d
[FE] test: `cypress`를 이용한 e2e 테스트, CI 추가 (#261)
yogjin bad5d38
[FE] feat: OAUTH 로그인 기능 (#233)
jeonjeunghoon c8d7ddb
[BE] feat: JWT 정책 구현 (#256)
ingpyo 6103dfd
refactor: `auth` 패키지 내의 예외 메시지 포맷 수정
HubCreator 61591b9
Merge branch 'develop' into feature/modify-exception-message-260
HubCreator 95ddf93
refactor: merge 후 필요 없는 클래스 삭제
HubCreator e34b655
refactor: 피드백 반영
HubCreator cf2bdb0
refactor: `RefreshTokenNotFoundException`을 `MemberNotFoundException`으…
HubCreator cecaa79
refactor: `ExpiredAccessTokenException`과 `ExpiredRefreshTokenExceptio…
HubCreator File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...rc/main/java/org/donggle/backend/auth/exception/AuthorizationHeaderNotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.donggle.backend.auth.exception; | ||
|
||
import org.donggle.backend.exception.authentication.AuthenticationException; | ||
|
||
public class AuthorizationHeaderNotFoundException extends AuthenticationException { | ||
public AuthorizationHeaderNotFoundException() { | ||
super(null); | ||
} | ||
|
||
public AuthorizationHeaderNotFoundException(final Throwable cause) { | ||
super(null, cause); | ||
} | ||
|
||
@Override | ||
public String getHint() { | ||
return "Authorization 해더값이 존재하지 않습니다."; | ||
} | ||
} |
11 changes: 0 additions & 11 deletions
11
...d/src/main/java/org/donggle/backend/auth/exception/EmptyAuthorizationHeaderException.java
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
backend/src/main/java/org/donggle/backend/auth/exception/ExpiredAccessTokenException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.donggle.backend.auth.exception; | ||
|
||
import org.donggle.backend.exception.authentication.AuthenticationException; | ||
|
||
public class ExpiredAccessTokenException extends AuthenticationException { | ||
private static final String MESSAGE = "유효하지 않은 토큰입니다."; | ||
|
||
public ExpiredAccessTokenException() { | ||
super(MESSAGE); | ||
} | ||
|
||
public ExpiredAccessTokenException(final Throwable cause) { | ||
super(MESSAGE, cause); | ||
} | ||
|
||
@Override | ||
public String getHint() { | ||
return "AccessToken이 만료되었습니다. RefreshToken값을 요청하세요."; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
backend/src/main/java/org/donggle/backend/auth/exception/ExpiredRefreshTokenException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.donggle.backend.auth.exception; | ||
|
||
import org.donggle.backend.exception.authentication.AuthenticationException; | ||
|
||
public class ExpiredRefreshTokenException extends AuthenticationException { | ||
private static final String MESSAGE = "유효하지 않은 토큰입니다."; | ||
|
||
public ExpiredRefreshTokenException() { | ||
super(MESSAGE); | ||
} | ||
|
||
public ExpiredRefreshTokenException(final Throwable cause) { | ||
super(MESSAGE, cause); | ||
} | ||
|
||
@Override | ||
public String getHint() { | ||
return "RefreshToken이 만료되었습니다. 다시 로그인을 진행하세요."; | ||
} | ||
} |
11 changes: 0 additions & 11 deletions
11
backend/src/main/java/org/donggle/backend/auth/exception/InvalidAccessTokenException.java
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
...main/java/org/donggle/backend/auth/exception/InvalidAuthorizationHeaderTypeException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.donggle.backend.auth.exception; | ||
|
||
import org.donggle.backend.exception.authentication.AuthenticationException; | ||
|
||
public class InvalidAuthorizationHeaderTypeException extends AuthenticationException { | ||
private final String authorizationHeader; | ||
|
||
public InvalidAuthorizationHeaderTypeException(final String authorizationHeader) { | ||
super(null); | ||
this.authorizationHeader = authorizationHeader; | ||
} | ||
|
||
public InvalidAuthorizationHeaderTypeException(final String authorizationHeader, final Throwable cause) { | ||
super(null, cause); | ||
this.authorizationHeader = authorizationHeader; | ||
} | ||
|
||
@Override | ||
public String getHint() { | ||
return "Authorization 헤더의 타입이 올바르지 않습니다. 입력한 헤더: " + authorizationHeader; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
backend/src/main/java/org/donggle/backend/auth/exception/InvalidRefreshTokenException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.donggle.backend.auth.exception; | ||
|
||
import org.donggle.backend.exception.authentication.AuthenticationException; | ||
|
||
public class InvalidRefreshTokenException extends AuthenticationException { | ||
public InvalidRefreshTokenException() { | ||
super(null); | ||
} | ||
|
||
public InvalidRefreshTokenException(final Throwable cause) { | ||
super(null, cause); | ||
} | ||
|
||
@Override | ||
public String getHint() { | ||
return "유효하지 않은 RefreshToken입니다. 다시 로그인을 진행하세요."; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...end/src/main/java/org/donggle/backend/auth/exception/NoRefreshTokenInCookieException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.donggle.backend.auth.exception; | ||
|
||
import org.donggle.backend.exception.authentication.AuthenticationException; | ||
|
||
public class NoRefreshTokenInCookieException extends AuthenticationException { | ||
public NoRefreshTokenInCookieException() { | ||
super(null); | ||
} | ||
|
||
public NoRefreshTokenInCookieException(final Throwable cause) { | ||
super(null, cause); | ||
} | ||
|
||
@Override | ||
public String getHint() { | ||
return "쿠키에 RefreshToken이 존재하지 않습니다."; | ||
} | ||
} |
11 changes: 0 additions & 11 deletions
11
backend/src/main/java/org/donggle/backend/auth/exception/NoSuchTokenException.java
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
backend/src/main/java/org/donggle/backend/auth/exception/RefreshTokenNotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.donggle.backend.auth.exception; | ||
|
||
import org.donggle.backend.exception.authentication.AuthenticationException; | ||
|
||
public class RefreshTokenNotFoundException extends AuthenticationException { | ||
public RefreshTokenNotFoundException() { | ||
super(null); | ||
} | ||
|
||
public RefreshTokenNotFoundException(final Throwable cause) { | ||
super(null, cause); | ||
} | ||
|
||
@Override | ||
public String getHint() { | ||
return "존재하지 않는 토큰입니다. 다시 로그인을 진행하세요."; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 9 additions & 1 deletion
10
...d/src/main/java/org/donggle/backend/exception/authentication/AuthenticationException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
package org.donggle.backend.exception.authentication; | ||
|
||
import org.springframework.http.HttpStatus; | ||
|
||
public abstract class AuthenticationException extends RuntimeException { | ||
public AuthenticationException(final String message) { | ||
super(message); | ||
} | ||
|
||
public AuthenticationException(final String message, final Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public abstract String getHint(); | ||
|
||
public final int getErrorCode() { | ||
return HttpStatus.UNAUTHORIZED.value(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
유효하지 않은 RefreshToken 이라는게 만료되었다는 건가요 !?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
현재 두 가지 상황에서 사용되고 있네요!
Member
로부터 찾은RefreshToken
이 다르거나,RefreshToken
자체의 만료 기간이 지났을 때에InvalidRefreshTokenException
을 뱉고 있어요.두 가지 상황을 분리하여 예외를 던지는 것이 좋을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Member로부터 찾은
RefreshToken
이 다를 때가 만료기간이 지났거나, 새로운 토큰이 발급되었을 때 발생하는 상황이 맞을까요 ?!그렇다면
ExpiredTokenException
과 같이ExpiredRefreshTokenException
을 던져줘도 괜찮지 않을까 생각했습니다 !There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
맞아요!
ExpiredRefreshTokenException
을 던지도록 상황을 구분하여 수정해봤습니다!