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 |
|---|---|
static java.lang.String |
PREFS_COOKIE_NAME
The name of the cookie that gets stored to the user browser.
|
static java.lang.String |
PROMPT
Deprecated.
|
m_handler, m_options, m_previousWikiPrincipals, m_principals, m_principalsToOverwrite, m_principalsToRemove, m_state, m_subject, NULL| Constructor and Description |
|---|
CookieAssertionLoginModule() |
| Modifier and Type | Method and Description |
|---|---|
static void |
clearUserCookie(HttpServletResponse response)
Removes the user cookie from the response.
|
static java.lang.String |
getUserCookie(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(HttpServletResponse response,
java.lang.String name)
Sets the username cookie.
|
abort, commit, initialize, logoutpublic static final java.lang.String PREFS_COOKIE_NAME
public static final java.lang.String PROMPT
public boolean login()
throws javax.security.auth.login.LoginException
login in interface javax.security.auth.spi.LoginModulelogin in class AbstractLoginModuletrue. If not found, this
method throws a FailedLoginException.{@inheritDoc}javax.security.auth.login.LoginException - if the authentication failsLoginModule.login()public static java.lang.String getUserCookie(HttpServletRequest request)
request - The Servlet request, as usual.public static void setUserCookie(HttpServletResponse response,
java.lang.String name)
response - The Servlet responsename - The name to write into the cookie.public static void clearUserCookie(HttpServletResponse response)
response - The servlet response.stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.