Class RequestMatcherDelegatingAccessDeniedHandler
java.lang.Object
org.springframework.security.web.access.RequestMatcherDelegatingAccessDeniedHandler
- All Implemented Interfaces:
AccessDeniedHandler
public final class RequestMatcherDelegatingAccessDeniedHandler
extends Object
implements AccessDeniedHandler
An
AccessDeniedHandler
that delegates to other AccessDeniedHandler
instances based upon the type of HttpServletRequest
passed into
handle(HttpServletRequest, HttpServletResponse, AccessDeniedException)
.- Since:
- 5.1
-
Constructor Summary
ConstructorDescriptionRequestMatcherDelegatingAccessDeniedHandler
(LinkedHashMap<RequestMatcher, AccessDeniedHandler> handlers, AccessDeniedHandler defaultHandler) 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
-
RequestMatcherDelegatingAccessDeniedHandler
public RequestMatcherDelegatingAccessDeniedHandler(LinkedHashMap<RequestMatcher, AccessDeniedHandler> handlers, AccessDeniedHandler defaultHandler) Creates a new instance- Parameters:
handlers
- a map ofRequestMatcher
s toAccessDeniedHandler
s that should be used. Each is considered in the order they are specified and only the firstAccessDeniedHandler
is used.defaultHandler
- the defaultAccessDeniedHandler
that should be used if none of the matchers match.
-
-
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
-