Spring(Boot) Security preauthorize auth return 200 on "false" instead of 403
Hello! Hope this is the right section .I've a "problem" with spring boot and spring security.
In controllers i've the classic
I would like to receive the error 403 (in order to redirect to the 403.ftlh in case of no authentication).
Just now instead if i open the page that does not pass the @PreAuthorize, returns the page with status 200, but blank, for because any api in the controlled is executed (correctly).
I tried to put in the security config an http.executionHandling() but it won't execute anyway.
The basic requests i've is:
But still get 200 (and blank page) opening that page
In controllers i've the classic
@PreAuthorize("hasAnyAuthority(....)").I would like to receive the error 403 (in order to redirect to the 403.ftlh in case of no authentication).
Just now instead if i open the page that does not pass the @PreAuthorize, returns the page with status 200, but blank, for because any api in the controlled is executed (correctly).
I tried to put in the security config an http.executionHandling() but it won't execute anyway.
The basic requests i've is:
But still get 200 (and blank page) opening that page