I want to redirect to a custom html page on an @PreAuthorize
authentication error?
I have used @PreAuthorize("hasRole("Admin"))
for a controller. So if the user doesn't have the Admin role he will be kicked out and I am seeing authentication error.
But I want to override this authentication failure error and redirect the user to standard error page I developed.
Is there a solution for it ?
Code:
@PreAuthorize("hasRole("Admin")){
public List<Object> getBooksList(String id){
return bookList;
}