Add refresh token generation

This commit is contained in:
Dmitrii Cravcenco
2023-10-12 12:52:39 +03:00
parent b1b13dc736
commit 3160a19fa5
8 changed files with 81 additions and 24 deletions

View File

@@ -0,0 +1,19 @@
package com.faf223.expensetrackerfaf.config;
import com.faf223.expensetrackerfaf.controller.auth.ErrorResponse;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
@ControllerAdvice
public class ExceptionHandlers {
@ExceptionHandler(TokenExpiredException.class)
@ResponseStatus(HttpStatus.UNAUTHORIZED)
@ResponseBody
public ErrorResponse handleTokenExpiredException(TokenExpiredException ex) {
return new ErrorResponse("Unauthorized", ex.getMessage());
}
}