Class AuthenticationRequiredHandlerImpl
java.lang.Object
org.craftercms.security.authentication.impl.AuthenticationRequiredHandlerImpl
- All Implemented Interfaces:
AuthenticationRequiredHandler
public class AuthenticationRequiredHandlerImpl
extends Object
implements AuthenticationRequiredHandler
Default implementation of
AuthenticationRequiredHandler:
- Saves the current request so it can be reused after successful login.
- Redirects to the login form URL.
- Author:
- Alfonso Vásquez
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected org.springframework.security.web.savedrequest.RequestCache -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringvoidhandle(org.craftercms.commons.http.RequestContext context, AuthenticationException e) Saves the current request in the request cache and then redirects to the login form page.protected voidsaveRequest(org.craftercms.commons.http.RequestContext context) protected voidsendError(AuthenticationException e, org.craftercms.commons.http.RequestContext context) voidsetLoginFormUrl(String loginFormUrl) Sets the URL of the login form page.voidsetRequestCache(org.springframework.security.web.savedrequest.RequestCache requestCache) Sets the cache where the current request is saved.
-
Field Details
-
loginFormUrl
-
requestCache
protected org.springframework.security.web.savedrequest.RequestCache requestCache
-
-
Constructor Details
-
AuthenticationRequiredHandlerImpl
public AuthenticationRequiredHandlerImpl()Default constructor
-
-
Method Details
-
setLoginFormUrl
Sets the URL of the login form page. -
getLoginFormUrl
-
setRequestCache
public void setRequestCache(org.springframework.security.web.savedrequest.RequestCache requestCache) Sets the cache where the current request is saved. -
handle
public void handle(org.craftercms.commons.http.RequestContext context, AuthenticationException e) throws SecurityProviderException, IOException Saves the current request in the request cache and then redirects to the login form page.- Specified by:
handlein interfaceAuthenticationRequiredHandler- Parameters:
context- the request security contexte- the exception with the reason for requiring authentication- Throws:
SecurityProviderExceptionIOException
-
saveRequest
protected void saveRequest(org.craftercms.commons.http.RequestContext context) -
sendError
protected void sendError(AuthenticationException e, org.craftercms.commons.http.RequestContext context) throws IOException - Throws:
IOException
-