public class SecurityExceptionProcessor extends Object implements RequestSecurityProcessor
AuthenticationRequiredException
, the AuthenticationRequiredHandler
is used.AccessDeniedException
, and the user is anonymous, the AuthenticationRequiredHandler
is used. If not, the AccessDeniedHandler
is used.Modifier and Type | Field and Description |
---|---|
protected AccessDeniedHandler |
accessDeniedHandler |
protected AuthenticationRequiredHandler |
authenticationRequiredHandler |
static org.slf4j.Logger |
logger |
Constructor and Description |
---|
SecurityExceptionProcessor() |
Modifier and Type | Method and Description |
---|---|
SecurityProviderException |
findSecurityException(Exception topException) |
protected void |
handleAccessDeniedException(org.craftercms.commons.http.RequestContext context,
AccessDeniedException e)
Handles the specified
AccessDeniedException , by calling the AccessDeniedHandler . |
protected void |
handleAuthenticationRequiredException(org.craftercms.commons.http.RequestContext context,
AuthenticationRequiredException e) |
protected void |
handleSecurityProviderException(SecurityProviderException e,
org.craftercms.commons.http.RequestContext context) |
void |
processRequest(org.craftercms.commons.http.RequestContext context,
RequestSecurityProcessorChain processorChain)
Catches any exception thrown by the processor chain.
|
void |
setAccessDeniedHandler(AccessDeniedHandler accessDeniedHandler)
Sets the
AccessDeniedHandler , to handle any AccessDeniedException s thrown. |
void |
setAuthenticationRequiredHandler(AuthenticationRequiredHandler authenticationRequiredHandler)
Sets the
AuthenticationRequiredHandler , to handle any AuthenticationRequiredException s thrown. |
public static final org.slf4j.Logger logger
protected AuthenticationRequiredHandler authenticationRequiredHandler
protected AccessDeniedHandler accessDeniedHandler
public void setAuthenticationRequiredHandler(AuthenticationRequiredHandler authenticationRequiredHandler)
AuthenticationRequiredHandler
, to handle any AuthenticationRequiredException
s thrown.public void setAccessDeniedHandler(AccessDeniedHandler accessDeniedHandler)
AccessDeniedHandler
, to handle any AccessDeniedException
s thrown.public void processRequest(org.craftercms.commons.http.RequestContext context, RequestSecurityProcessorChain processorChain) throws Exception
SecurityProviderException
, the exception is handled to see if authentication is required
(AuthenticationRequiredException
), or if access to the resource is denied
(AccessDeniedException
).processRequest
in interface RequestSecurityProcessor
context
- the context which holds the current request and responseprocessorChain
- the processor chain, used to call the next processorException
public SecurityProviderException findSecurityException(Exception topException)
protected void handleSecurityProviderException(SecurityProviderException e, org.craftercms.commons.http.RequestContext context) throws SecurityProviderException, IOException
SecurityProviderException
IOException
protected void handleAuthenticationRequiredException(org.craftercms.commons.http.RequestContext context, AuthenticationRequiredException e) throws SecurityProviderException, IOException
SecurityProviderException
IOException
protected void handleAccessDeniedException(org.craftercms.commons.http.RequestContext context, AccessDeniedException e) throws SecurityProviderException, IOException
AccessDeniedException
, by calling the AccessDeniedHandler
.SecurityProviderException
IOException
Copyright © 2023 CrafterCMS. All rights reserved.