|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.securityfilter.authenticator.persistent.DefaultPersistentLoginManager
com.xpn.xwiki.user.impl.xwiki.MyPersistentLoginManager
public class MyPersistentLoginManager
Class responsible for remembering the login information between requests. It uses (encrypted) cookies for this. The encryption key is stored in xwiki.cfg, xwiki.authentication.encryptionKey parameter. The cookies used are:
Field Summary | |
---|---|
protected String[] |
cookieDomains
The domain generalization for which the cookies are active. |
protected String |
cookiePath
The path for which the cookies are active. |
protected String |
cookiePrefix
The prefix that should be used for cookie names. |
Fields inherited from class org.securityfilter.authenticator.persistent.DefaultPersistentLoginManager |
---|
cipherParameters, COOKIE_PASSWORD, COOKIE_REMEMBERME, COOKIE_USERNAME, COOKIE_VALIDATION, cookieLife, encryptionAlgorithm, encryptionKey, encryptionMode, encryptionPadding, protection, PROTECTION_ALL, PROTECTION_ENCRYPTION, PROTECTION_NONE, PROTECTION_VALIDATION, secretKey, useIP, validationKey, valueAfterMD5, valueBeforeMD5 |
Constructor Summary | |
---|---|
MyPersistentLoginManager()
Default constructor. |
Method Summary | |
---|---|
String |
encryptText(String clearText)
Encrypt a string. |
void |
forgetLogin(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Forget a login by removing the authentication cookies. |
protected String |
getClientIP(javax.servlet.http.HttpServletRequest request)
Returns the original client IP. |
String |
getCookiePrefix()
Getter for the cookiePrefix parameter. |
String |
getRememberedPassword(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Get the password stored (in a cookie) in the request. |
String |
getRememberedUsername(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Get the username stored (in a cookie) in the request. |
boolean |
rememberingLogin(javax.servlet.http.HttpServletRequest request)
|
void |
rememberLogin(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String username,
String password)
Remember a specific login using cookies. |
void |
setCookieDomains(String[] cdlist)
Setter for the cookieDomains parameter. |
void |
setCookiePath(String cp)
Setter for the cookiePath parameter. |
void |
setCookiePrefix(String prefix)
Setter for the cookiePrefix parameter. |
void |
setupCookie(javax.servlet.http.Cookie cookie,
boolean sessionCookie,
String cookieDomain,
javax.servlet.http.HttpServletResponse response)
Setup a cookie: expiration date, path, domain + send it to the response. |
Methods inherited from class org.securityfilter.authenticator.persistent.DefaultPersistentLoginManager |
---|
setCookieLife, setEncryptionAlgorithm, setEncryptionKey, setEncryptionMode, setEncryptionPadding, setProtection, setUseIP, setValidationKey |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String[] cookieDomains
protected String cookiePath
protected String cookiePrefix
Constructor Detail |
---|
public MyPersistentLoginManager()
XWikiAuthServiceImpl.getAuthenticator(com.xpn.xwiki.XWikiContext)
, so no parameters are needed at this
point.
Method Detail |
---|
public void setCookieDomains(String[] cdlist)
cookieDomains
parameter.
cdlist
- The new value for cookieDomains
. The list is processed, so that any value not starting
with a dot is prefixed with one, to respect the cookie RFC.cookieDomains
public void setCookiePath(String cp)
cookiePath
parameter.
cp
- The new value for cookiePath
.cookiePath
public void setupCookie(javax.servlet.http.Cookie cookie, boolean sessionCookie, String cookieDomain, javax.servlet.http.HttpServletResponse response)
cookie
- The cookie to setup.sessionCookie
- Whether the cookie is only for this session, or for a longer period.cookieDomain
- The domain for which the cookie is set.response
- The servlet response.public void rememberLogin(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String username, String password)
rememberLogin
in interface org.securityfilter.authenticator.persistent.PersistentLoginManagerInterface
rememberLogin
in class org.securityfilter.authenticator.persistent.DefaultPersistentLoginManager
request
- The servlet request.response
- The servlet response.username
- The username that's being remembered.password
- The password that's being remembered.public String encryptText(String clearText)
clearText
- The text to be encrypted.
public void forgetLogin(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
forgetLogin
in interface org.securityfilter.authenticator.persistent.PersistentLoginManagerInterface
forgetLogin
in class org.securityfilter.authenticator.persistent.DefaultPersistentLoginManager
request
- The servlet request.response
- The servlet response.public String getRememberedUsername(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
getRememberedUsername
in interface org.securityfilter.authenticator.persistent.PersistentLoginManagerInterface
getRememberedUsername
in class org.securityfilter.authenticator.persistent.DefaultPersistentLoginManager
request
- The servlet request.response
- The servlet response.
public String getRememberedPassword(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
getRememberedPassword
in interface org.securityfilter.authenticator.persistent.PersistentLoginManagerInterface
getRememberedPassword
in class org.securityfilter.authenticator.persistent.DefaultPersistentLoginManager
request
- The servlet request.response
- The servlet response.
public boolean rememberingLogin(javax.servlet.http.HttpServletRequest request)
rememberingLogin
in interface org.securityfilter.authenticator.persistent.PersistentLoginManagerInterface
rememberingLogin
in class org.securityfilter.authenticator.persistent.DefaultPersistentLoginManager
protected String getClientIP(javax.servlet.http.HttpServletRequest request)
request
- The servlet request.
public void setCookiePrefix(String prefix)
cookiePrefix
parameter.
prefix
- The new value for cookiePrefix
.cookiePrefix
public String getCookiePrefix()
cookiePrefix
parameter.
cookiePrefix
.cookiePrefix
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |