public class CookieAuthenticationLoginModule extends AbstractLoginModule
jspwiki.workDir, under the directory
"logincookies". For security purposes it is a very, very good idea
to prevent access to this directory by everyone except the web server process;
otherwise people having read access to this directory may be able to spoof
other users.
The cookie directory is scrubbed of old entries at regular intervals.
This module must be used with a CallbackHandler (such as
WebContainerCallbackHandler) that supports the following Callback
types:
HttpRequestCallback- supplies the cookie, which should contain
an unique id for fetching the UID.WikiEngineCallback - allows access to the Engine itself.
After authentication, a generic WikiPrincipal based on the username will be created and associated with the Subject.
LoginModule.commit(),
CookieAssertionLoginModule| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
COOKIE_DIR
The directory name under which the cookies are stored.
|
static java.lang.String |
PROP_LOGIN_EXPIRY_DAYS
User property for setting how long the cookie is stored on the user's computer.
|
m_handler, m_options, m_principals, m_state, m_subject, NULL| Constructor and Description |
|---|
CookieAuthenticationLoginModule() |
| Modifier and Type | Method and Description |
|---|---|
static void |
clearLoginCookie(Engine engine,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Clears away the login cookie, and removes the uid-username mapping file as well.
|
boolean |
login()
Logs in the user by calling back to the registered CallbackHandler with a
series of callbacks.
|
static void |
setLoginCookie(Engine engine,
javax.servlet.http.HttpServletResponse response,
java.lang.String username)
Sets a login cookie based on properties set by the user.
|
abort, commit, initialize, logoutprotected static final java.lang.String COOKIE_DIR
public static final java.lang.String PROP_LOGIN_EXPIRY_DAYS
public CookieAuthenticationLoginModule()
public boolean login() throws javax.security.auth.login.LoginException
truelogin in interface javax.security.auth.spi.LoginModulelogin in class AbstractLoginModuletrue if the commit succeeded, or
false if this LoginModule should be ignored.javax.security.auth.login.LoginException - if the authentication failsLoginModule.login()public static void setLoginCookie(Engine engine, javax.servlet.http.HttpServletResponse response, java.lang.String username)
engine - The Engineresponse - The HttpServletResponseusername - The username for whom to create the cookie.public static void clearLoginCookie(Engine engine, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
engine - Enginerequest - Servlet requestresponse - Servlet responseCopyright (c) 2001-2022 The Apache Software Foundation. All rights reserved.