public class CookieAssertionLoginModule extends AbstractLoginModule
Logs in a user based on assertion of a name supplied in a cookie. If the cookie is not found, authentication fails.
This module must be used with a CallbackHandler (such asWebContainerCallbackHandler) that supports the following Callback
types:
HttpRequestCallback- supplies the cookie, which should contain
a user name.After authentication, a generic WikiPrincipal based on the username will be created and associated with the Subject.
LoginModule.commit(),
CookieAuthenticationLoginModule| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.log4j.Logger |
log |
static String |
PREFS_COOKIE_NAME
The name of the cookie that gets stored to the user browser.
|
m_handler, m_options, m_principals, m_state, m_subject, NULL| Constructor and Description |
|---|
CookieAssertionLoginModule() |
| Modifier and Type | Method and Description |
|---|---|
static void |
clearUserCookie(javax.servlet.http.HttpServletResponse response)
Removes the user cookie from the response.
|
static String |
getUserCookie(javax.servlet.http.HttpServletRequest request)
Returns the username cookie value.
|
boolean |
login()
Logs in the user by calling back to the registered CallbackHandler with
an HttpRequestCallback.
|
static void |
setUserCookie(javax.servlet.http.HttpServletResponse response,
String name)
Sets the username cookie.
|
abort, commit, initialize, logoutpublic static final String PREFS_COOKIE_NAME
protected static final org.apache.log4j.Logger log
public CookieAssertionLoginModule()
public boolean login() throws LoginException
login in interface LoginModulelogin in class AbstractLoginModuletrue. If not found, this
method throws a FailedLoginException.{@inheritDoc}LoginException - if the authentication failsLoginModule.login()public static String getUserCookie(javax.servlet.http.HttpServletRequest request)
request - The Servlet request, as usual.public static void setUserCookie(javax.servlet.http.HttpServletResponse response, String name)
response - The Servlet responsename - The name to write into the cookie.public static void clearUserCookie(javax.servlet.http.HttpServletResponse response)
response - The servlet response.Copyright © 2001-2019 The Apache Software Foundation. All rights reserved.