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 String
protected org.springframework.security.web.savedrequest.RequestCache
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
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 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:
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
-