-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: JWT decrypt 예외시 AuthException을 던지도록하고, 전역 Advice를 등록 (#403)
- Loading branch information
Showing
7 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
...h-application/src/main/java/me/nalab/auth/application/common/exception/AuthException.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,8 @@ | ||
package me.nalab.auth.application.common.exception; | ||
|
||
public class AuthException extends RuntimeException { | ||
|
||
public AuthException(String message) { | ||
super(message); | ||
} | ||
} |
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
19 changes: 19 additions & 0 deletions
19
...auth-web-adaptor/src/main/java/me/nalab/auth/web/adaptor/advice/AuthControllerAdvice.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,19 @@ | ||
package me.nalab.auth.web.adaptor.advice; | ||
|
||
import me.nalab.auth.application.common.exception.AuthException; | ||
import me.nalab.core.exception.handler.ErrorTemplate; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
|
||
@RestControllerAdvice | ||
public class AuthControllerAdvice { | ||
|
||
@ExceptionHandler(AuthException.class) | ||
@ResponseStatus(HttpStatus.UNAUTHORIZED) | ||
public ErrorTemplate handleAuthException(AuthException authException) { | ||
return ErrorTemplate.of(authException.getMessage()); | ||
} | ||
|
||
} |
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