Class HttpStatusAccessDeniedHandler
java.lang.Object
org.springframework.security.web.access.HttpStatusAccessDeniedHandler
- All Implemented Interfaces:
AccessDeniedHandler
An
AccessDeniedHandler
that sends an HttpStatus
as a response.- Since:
- 6.5
-
Constructor Summary
ConstructorDescriptionHttpStatusAccessDeniedHandler
(org.springframework.http.HttpStatus httpStatus) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
handle
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, AccessDeniedException accessDeniedException) Handles an access denied failure.
-
Constructor Details
-
HttpStatusAccessDeniedHandler
public HttpStatusAccessDeniedHandler(org.springframework.http.HttpStatus httpStatus) Creates a new instance.- Parameters:
httpStatus
- the HttpStatus to set
-
-
Method Details
-
handle
public void handle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, jakarta.servlet.ServletException Description copied from interface:AccessDeniedHandler
Handles an access denied failure.- Specified by:
handle
in interfaceAccessDeniedHandler
- Parameters:
request
- that resulted in anAccessDeniedException
response
- so that the user agent can be advised of the failureaccessDeniedException
- that caused the invocation- Throws:
IOException
- in the event of an IOExceptionjakarta.servlet.ServletException
- in the event of a ServletException
-