|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.caucho.security.AbstractAuthenticator
public class AbstractAuthenticator
All applications should extend AbstractAuthenticator to implement their custom authenticators. While this isn't absolutely required, it protects implementations from API changes.
The AbstractAuthenticator provides a single-signon cache. Users logged into one web-app will share the same principal.
| Field Summary | |
|---|---|
protected PasswordDigest |
_passwordDigest
|
protected java.lang.String |
_passwordDigestAlgorithm
|
protected java.lang.String |
_passwordDigestRealm
|
| Constructor Summary | |
|---|---|
AbstractAuthenticator()
|
|
| Method Summary | |
|---|---|
void |
addRoleMapping(java.security.Principal principal,
java.lang.String role)
Adds a role mapping. |
java.security.Principal |
authenticate(java.security.Principal user,
Credentials credentials,
java.lang.Object details)
Authenticator main call to login a user. |
protected java.security.Principal |
authenticate(java.security.Principal principal,
DigestCredentials cred,
java.lang.Object details)
Validates the user when HTTP Digest authentication. |
protected java.security.Principal |
authenticate(java.security.Principal principal,
PasswordCredentials cred,
java.lang.Object details)
Main authenticator API. |
protected byte[] |
digest(java.lang.String value)
|
protected byte[] |
getDigestSecret(java.security.Principal principal,
java.lang.String realm)
Returns the digest secret for Digest authentication. |
boolean |
getLogoutOnSessionTimeout()
Returns true if the user should be logged out on a session timeout. |
PasswordDigest |
getPasswordDigest()
Returns the password digest |
protected char[] |
getPasswordDigest(java.lang.String user,
char[] password)
Returns the digest view of the password. |
java.lang.String |
getPasswordDigestAlgorithm()
Returns the password digest algorithm |
java.lang.String |
getPasswordDigestRealm()
Returns the password digest realm |
protected PasswordUser |
getPasswordUser(java.security.Principal principal)
Returns the user based on a principal |
protected PasswordUser |
getPasswordUser(java.lang.String userName)
Abstract method to return a user based on the name |
SingleSignon |
getSingleSignon()
Returns the scoped single-signon |
void |
init()
Initialize the authenticator with the application. |
boolean |
isUserInRole(java.security.Principal user,
java.lang.String role)
Returns true if the user plays the named role. |
void |
logout(java.security.Principal user)
Logs the user out from the session. |
void |
setLogoutOnSessionTimeout(boolean logout)
Sets true if the principal should logout when the session times out. |
void |
setPasswordDigest(PasswordDigest digest)
Sets the password digest. |
void |
setPasswordDigestAlgorithm(java.lang.String digest)
Sets the password digest algorithm. |
void |
setPasswordDigestRealm(java.lang.String realm)
Sets the password digest realm. |
void |
setSerializationHandle(java.lang.Object handle)
Sets the serialization handle |
protected byte[] |
stringToDigest(java.lang.String digest)
|
java.lang.String |
toString()
|
java.lang.Object |
writeReplace()
Serialize to the handle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String _passwordDigestAlgorithm
protected java.lang.String _passwordDigestRealm
protected PasswordDigest _passwordDigest
| Constructor Detail |
|---|
public AbstractAuthenticator()
| Method Detail |
|---|
public PasswordDigest getPasswordDigest()
public void setPasswordDigest(PasswordDigest digest)
public java.lang.String getPasswordDigestAlgorithm()
public void setPasswordDigestAlgorithm(java.lang.String digest)
public java.lang.String getPasswordDigestRealm()
public void setPasswordDigestRealm(java.lang.String realm)
public boolean getLogoutOnSessionTimeout()
public void setLogoutOnSessionTimeout(boolean logout)
public void addRoleMapping(java.security.Principal principal,
java.lang.String role)
@PostConstruct
public void init()
throws ServletException
ServletException
public java.security.Principal authenticate(java.security.Principal user,
Credentials credentials,
java.lang.Object details)
authenticate in interface Authenticatoruser - the Login's user, generally a BasicPrincipal just containing
the name, but may contain an X.509 certificatecredentials - the login credentialsdetails - extra information, e.g. HttpServletRequest
public boolean isUserInRole(java.security.Principal user,
java.lang.String role)
isUserInRole in interface Authenticatoruser - the user to testrole - the role to testpublic void logout(java.security.Principal user)
logout in interface Authenticatoruser - the logged in user
protected java.security.Principal authenticate(java.security.Principal principal,
PasswordCredentials cred,
java.lang.Object details)
protected char[] getPasswordDigest(java.lang.String user,
char[] password)
protected java.security.Principal authenticate(java.security.Principal principal,
DigestCredentials cred,
java.lang.Object details)
A1 = MD5(username + ':' + realm + ':' + password)
A2 = MD5(method + ':' + uri)
digest = MD5(A1 + ':' + nonce + A2)
principal - the user trying to authenticate.cred - the digest credentials
protected byte[] getDigestSecret(java.security.Principal principal,
java.lang.String realm)
protected PasswordUser getPasswordUser(java.lang.String userName)
userName - the string user name
protected PasswordUser getPasswordUser(java.security.Principal principal)
public SingleSignon getSingleSignon()
protected byte[] stringToDigest(java.lang.String digest)
protected byte[] digest(java.lang.String value)
throws ServletException
ServletExceptionpublic void setSerializationHandle(java.lang.Object handle)
setSerializationHandle in interface HandleAwarepublic java.lang.Object writeReplace()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||