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 String
loginFormUrl
protected org.springframework.security.web.savedrequest.RequestCache
requestCache
-
Constructor Summary
Constructors Constructor Description AuthenticationRequiredHandlerImpl()
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getLoginFormUrl()
void
handle(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 void
saveRequest(org.craftercms.commons.http.RequestContext context)
protected void
sendError(AuthenticationException e, org.craftercms.commons.http.RequestContext context)
void
setLoginFormUrl(String loginFormUrl)
Sets the URL of the login form page.void
setRequestCache(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, IOException
Saves the current request in the request cache and then redirects to the login form page.- Specified by:
handle
in interfaceAuthenticationRequiredHandler
- Parameters:
context
- the request security contexte
- the exception with the reason for requiring authentication- Throws:
SecurityProviderException
IOException
-
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
-
-