feat: user token exception

This commit is contained in:
박정민 2024-08-02 17:39:51 +09:00
parent 03ff837ad5
commit a44d29ee1e
3 changed files with 2 additions and 14 deletions

View File

@ -78,9 +78,6 @@ public class UserController {
@RequestBody @Parameter(description = "로그인 시 필요한 회원정보(아이디, 비밀번호).", required = true) User user, HttpServletRequest request, HttpServletResponse response) { @RequestBody @Parameter(description = "로그인 시 필요한 회원정보(아이디, 비밀번호).", required = true) User user, HttpServletRequest request, HttpServletResponse response) {
String token = request.getHeader("Authorization"); String token = request.getHeader("Authorization");
if(jwtUtil.checkToken(token)){
return new ResponseEntity<>(HttpStatus.FORBIDDEN);
}
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
HttpStatus status = HttpStatus.ACCEPTED; HttpStatus status = HttpStatus.ACCEPTED;
@ -218,15 +215,6 @@ public class UserController {
} }
@ExceptionHandler(ExpriedTokenException.class)
public ResponseEntity<?> handleExpiredTokenException(){
return new ResponseEntity<>(HttpStatus.UNAUTHORIZED);
}
@ExceptionHandler(UnAuthorizedException.class)
public ResponseEntity<?> handleUnauthorizedException(){
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}

View File

@ -10,7 +10,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler(InvalidTokenException.class) @ExceptionHandler(InvalidTokenException.class)
public ResponseEntity<String> handleInvalidTokenException(InvalidTokenException e) { public ResponseEntity<String> handleInvalidTokenException(InvalidTokenException e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST); return new ResponseEntity<>(e.getMessage(), HttpStatus.FORBIDDEN);
} }
// //

View File

@ -17,7 +17,7 @@ jwt.salt=${SALT}
# Access Token ?? ?? (??? ??) # Access Token ?? ?? (??? ??)
#jwt.access-token.expiretime=3600000 #jwt.access-token.expiretime=3600000
jwt.access-token.expiretime=3000 jwt.access-token.expiretime=300
# Refresh Token ?? ?? (??? ??) # Refresh Token ?? ?? (??? ??)
jwt.refresh-token.expiretime=50400000 jwt.refresh-token.expiretime=50400000