public final class CookieAuthenticationHandler extends AuthenticationHandler
"auth-mgr.cookie-enabled"
.
Cookie can be disabled for admin by modifiying property "auth-mgr.allow-admin-cookie"
.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AUTHENTICATION_COOKIE_NAME
Name of cookie used for authentication.
|
static int |
ORDER_COOKIE_HANDLER
Order used by the CookieAuthenticationHandler
|
static java.lang.String |
REVISION |
channel, GENERIC_BAD_AUTHENTICATION_MSG
Modifier and Type | Method and Description |
---|---|
static Member |
checkAuthenticationFromCookie(javax.servlet.http.Cookie[] cookies)
Returns the member corresponding to the member id which is
contains in memberId cookie.
|
static boolean |
checkCookieDigest(java.lang.String digest,
java.lang.String timeStr,
Member member)
Check if the specified time and password matches the encoded digest.
|
static javax.servlet.http.Cookie |
getAuthenticationCookie(Member member,
java.lang.String domain,
java.lang.String path,
boolean isPersistent)
Returns a cookie for a given member
|
static java.lang.String |
getCookieDigest(java.lang.String timeStr,
Member member)
Returns the cookie digest for the specified time and Member.
|
static java.lang.String |
getCookieDigest(java.lang.String timeStr,
java.lang.String password)
Deprecated.
|
static javax.servlet.http.Cookie |
getEmptyAuthenticationCookie(java.lang.String domain,
java.lang.String path)
Returns an empty authentication cookie (used for logout)
|
static CookieAuthenticationHandler |
getInstance() |
void |
loadProperties()
This method will be called by the AuthenticationManager each time the
Channel properties are loaded/reloaded.
|
void |
login(AuthenticationContext ctxt)
Authenticate a member.
|
void |
logout(AuthenticationContext ctxt)
This methods is called when users logout from JCMS.
|
public static final java.lang.String REVISION
public static final int ORDER_COOKIE_HANDLER
public static final java.lang.String AUTHENTICATION_COOKIE_NAME
public static final CookieAuthenticationHandler getInstance()
public void loadProperties()
AuthenticationHandler
loadProperties
in class AuthenticationHandler
public void login(AuthenticationContext ctxt) throws java.io.IOException
AuthenticationHandler
AuthenticationContext
object (request, response, login.. etc) AuthenticationContext.setLoggedMember(com.jalios.jcms.Member)
AuthenticationContext.doChain()
,AuthenticationContext
.login
in class AuthenticationHandler
ctxt
- the AuthenticationContext
used for this loginjava.io.IOException
public void logout(AuthenticationContext ctxt) throws java.io.IOException
AuthenticationHandler
logout
in class AuthenticationHandler
ctxt
- the AuthenticationContext
used for this loginjava.io.IOException
public static final java.lang.String getCookieDigest(java.lang.String timeStr, java.lang.String password)
timeStr
- a time as a string (e.g. String.valueOf(System.currentTimeMillis())
)password
- the Member's password in its crypted version (e.g. member.getPassword()
)public static final java.lang.String getCookieDigest(java.lang.String timeStr, Member member)
timeStr
- a time as a string (e.g. String.valueOf(System.currentTimeMillis())
)member
- the Member for which the digest is computedpublic static final boolean checkCookieDigest(java.lang.String digest, java.lang.String timeStr, Member member)
digest
- the digest to check (as returned by getCookieDigest(String, String)
timeStr
- a time as a string (e.g. String.valueOf(System.currentTimeMillis())
)member
- the Member against which the digest is verifiedpublic static final Member checkAuthenticationFromCookie(javax.servlet.http.Cookie[] cookies)
cookies
- an array of cookies (request.getCookies())public static final javax.servlet.http.Cookie getAuthenticationCookie(Member member, java.lang.String domain, java.lang.String path, boolean isPersistent) throws java.net.UnknownHostException
member
- the member to use to generate the cookie.domain
- an optionnal String containing the domain name within which the cookie is visible; form is according to RFC 2109path
- the cookie pathisPersistent
- if true the cookie will persist on the user disk beyond the
browser shutdown ; otherwise it will persist until browser shutdown.java.net.UnknownHostException
- if the specified domain could not be resolvedpublic static final javax.servlet.http.Cookie getEmptyAuthenticationCookie(java.lang.String domain, java.lang.String path) throws java.net.UnknownHostException
domain
- the cookie domain (can be null)path
- the cookie pathjava.net.UnknownHostException
- if the specified domain could not be resolvedCopyright © 2001-2010 Jalios SA. All Rights Reserved.