example.cmp.transaction
Class CMPAuthenticator
java.lang.Object
|
+--com.caucho.server.http.AbstractAuthenticator
|
+--example.cmp.transaction.CMPAuthenticator
- All Implemented Interfaces:
- com.caucho.server.http.Authenticator
- public class CMPAuthenticator
- extends com.caucho.server.http.AbstractAuthenticator
A custom Authenticator that looks up users in the Student
CMP bean.
Fields inherited from class com.caucho.server.http.AbstractAuthenticator |
application, cookieDomain, cookieMaxAge, LOGIN_NAME, params, principalCache, principalCacheSize, useCookie |
Method Summary |
java.security.Principal |
authenticate(java.lang.String user,
java.lang.String password)
Authenticate for the user and password. |
java.security.Principal |
authenticateCookie(java.lang.String cookieValue)
For more sophisticated sites, this would allow cookie-based
authentication so the user doesn't always have to login. |
private StudentHome |
getStudentHome()
Returns the student home, looking it up in the JNDI context
if necessary. |
void |
init(com.caucho.server.http.CauchoApplication app,
com.caucho.util.RegistryNode params)
init is called when the application starts. |
boolean |
isUserInRole(java.security.Principal user,
java.lang.String role)
Returns true if the user is in the specified role. |
boolean |
updateCookie(java.security.Principal user,
java.lang.String cookieValue)
If we were storing cookies, this would store the pair
in some sort of persistent storage. |
Methods inherited from class com.caucho.server.http.AbstractAuthenticator |
addCookieAuth, authenticate, authenticate, authenticateCookie, getCookieDomain, getCookieMaxAge, getCookiePrincipal, getPrincipalCacheSize, getServletContext, getUseCookie, init, isUserInRole, login, login, logout, setCookieDomain, setCookieMaxAge, setPrincipalCacheSize, setUseCookie, updateCookie |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
studentHome
StudentHome studentHome
- Home Interface for the Student bean.
CMPAuthenticator
public CMPAuthenticator()
init
public void init(com.caucho.server.http.CauchoApplication app,
com.caucho.util.RegistryNode params)
- init is called when the application starts.
- Overrides:
init
in class com.caucho.server.http.AbstractAuthenticator
authenticateCookie
public java.security.Principal authenticateCookie(java.lang.String cookieValue)
- For more sophisticated sites, this would allow cookie-based
authentication so the user doesn't always have to login.
Since Hogwarts student will tend to access the web from
public labs, we won't use cookies.
- Overrides:
authenticateCookie
in class com.caucho.server.http.AbstractAuthenticator
authenticate
public java.security.Principal authenticate(java.lang.String user,
java.lang.String password)
- Authenticate for the user and password.
- Overrides:
authenticate
in class com.caucho.server.http.AbstractAuthenticator
getStudentHome
private StudentHome getStudentHome()
throws javax.naming.NamingException
- Returns the student home, looking it up in the JNDI context
if necessary.
updateCookie
public boolean updateCookie(java.security.Principal user,
java.lang.String cookieValue)
- If we were storing cookies, this would store the pair
in some sort of persistent storage.
- Overrides:
updateCookie
in class com.caucho.server.http.AbstractAuthenticator
isUserInRole
public boolean isUserInRole(java.security.Principal user,
java.lang.String role)
- Returns
true
if the user is in the specified role.
For this example, simlpy returns true if the user exists.
- Overrides:
isUserInRole
in class com.caucho.server.http.AbstractAuthenticator