Class AccessDeniedHandlerImpl
- java.lang.Object
-
- org.craftercms.security.authorization.impl.AccessDeniedHandlerImpl
-
- All Implemented Interfaces:
AccessDeniedHandler
public class AccessDeniedHandlerImpl extends Object implements AccessDeniedHandler
Default implementation ofAccessDeniedHandler, which forwards to the error page URL, so that the original URL is preserved in the browser. If not error URL is specified, a 403 FORBIDDEN error is sent.- Author:
- Alfonso Vásquez
-
-
Field Summary
Fields Modifier and Type Field Description protected StringerrorPageUrl
-
Constructor Summary
Constructors Constructor Description AccessDeniedHandlerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidforwardToErrorPage(org.craftercms.commons.http.RequestContext context)protected StringgetErrorPageUrl()voidhandle(org.craftercms.commons.http.RequestContext context, AccessDeniedException e)Forwards to the error page, but if not error page was specified, a 403 error is sent.protected voidsaveException(org.craftercms.commons.http.RequestContext context, AccessDeniedException e)protected voidsendError(AccessDeniedException e, org.craftercms.commons.http.RequestContext requestContext)voidsetErrorPageUrl(String errorPageUrl)Sets the error page URL to forward to.
-
-
-
Field Detail
-
errorPageUrl
protected String errorPageUrl
-
-
Method Detail
-
setErrorPageUrl
public void setErrorPageUrl(String errorPageUrl)
Sets the error page URL to forward to.
-
getErrorPageUrl
protected String getErrorPageUrl()
-
handle
public void handle(org.craftercms.commons.http.RequestContext context, AccessDeniedException e) throws SecurityProviderException, IOExceptionForwards to the error page, but if not error page was specified, a 403 error is sent.- Specified by:
handlein interfaceAccessDeniedHandler- Parameters:
context- the request contexte- the exception with the reason of the access deny- Throws:
SecurityProviderExceptionIOException
-
saveException
protected void saveException(org.craftercms.commons.http.RequestContext context, AccessDeniedException e)
-
forwardToErrorPage
protected void forwardToErrorPage(org.craftercms.commons.http.RequestContext context) throws SecurityProviderException, IOException- Throws:
SecurityProviderExceptionIOException
-
sendError
protected void sendError(AccessDeniedException e, org.craftercms.commons.http.RequestContext requestContext) throws IOException
- Throws:
IOException
-
-