Class AuthenticationRequiredHandlerImpl
- java.lang.Object
-
- org.craftercms.security.authentication.impl.AuthenticationRequiredHandlerImpl
-
- All Implemented Interfaces:
AuthenticationRequiredHandler
public class AuthenticationRequiredHandlerImpl extends Object implements AuthenticationRequiredHandler
Default implementation ofAuthenticationRequiredHandler:- Saves the current request so it can be reused after successful login.
- Redirects to the login form URL.
- Author:
- Alfonso Vásquez
-
-
Field Summary
Fields Modifier and Type Field Description protected StringloginFormUrlprotected org.springframework.security.web.savedrequest.RequestCacherequestCache
-
Constructor Summary
Constructors Constructor Description AuthenticationRequiredHandlerImpl()Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringgetLoginFormUrl()voidhandle(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 Detail
-
loginFormUrl
protected String loginFormUrl
-
requestCache
protected org.springframework.security.web.savedrequest.RequestCache requestCache
-
-
Method Detail
-
setLoginFormUrl
public void setLoginFormUrl(String loginFormUrl)
Sets the URL of the login form page.
-
getLoginFormUrl
protected String 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, IOExceptionSaves 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
-
-