Skip to content

Commit

Permalink
fix: membership-service jwt expired
Browse files Browse the repository at this point in the history
  • Loading branch information
downfa11 committed Jul 4, 2024
1 parent 7f2ba77 commit 15b2c25
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.ns.membership;

import io.jsonwebtoken.ExpiredJwtException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class JwtExceptionHandler {

@ExceptionHandler(ExpiredJwtException.class)
public ResponseEntity<String> handleExpiredJwtException(ExpiredJwtException ex) {
return ResponseEntity.status(HttpStatus.UNAUTHORIZED)
.body("JWT token has expired");
}
}

0 comments on commit 15b2c25

Please sign in to comment.