|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.catalina.realm.JAASMemoryLoginModule
Implementation of the JAAS LoginModule interface,
primarily for use in testing JAASRealm. It utilizes an
XML-format data file of username/password/role information identical to
that supported by org.apache.catalina.realm.MemoryRealm
(except that digested passwords are not supported).
This class recognizes the following string-valued options, which are
specified in the configuration file (and passed to our constructor in
the options argument:
false.MemoryRealm. The default value matches the MemoryRealm
default.IMPLEMENTATION NOTE - This class implements
Realm only to satisfy the calling requirements of the
GenericPrincipal constructor. It does not actually perform
the functionality required of a Realm implementation.
| Field Summary | |
protected javax.security.auth.callback.CallbackHandler |
callbackHandler
The callback handler responsible for answering our requests. |
protected boolean |
committed
Has our own commit() returned successfully? |
protected boolean |
debug
Should we log debugging messages? |
protected java.util.Map |
options
The configuration information for this LoginModule. |
protected java.lang.String |
pathname
The absolute or relative pathname to the XML configuration file. |
protected java.security.Principal |
principal
The Principal identified by our validation, or
null if validation falied. |
protected java.util.HashMap |
principals
The set of Principals loaded from our configuration file. |
protected java.util.Map |
sharedState
The state information that is shared with other configured LoginModule instances. |
protected javax.security.auth.Subject |
subject
The subject for which we are performing authentication. |
| Constructor Summary | |
JAASMemoryLoginModule()
|
|
| Method Summary | |
boolean |
abort()
Phase 2 of authenticating a Subject when Phase 1
fails. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a property change listener to this component. |
java.security.Principal |
authenticate(java.lang.String username,
byte[] credentials)
Return the Principal associated with the specified username and credentials, if there is one; otherwise return null. |
java.security.Principal |
authenticate(java.lang.String username,
java.lang.String credentials)
Return the Principal associated with the specified username and credentials, if there is one; otherwise return null. |
java.security.Principal |
authenticate(java.lang.String username,
java.lang.String digest,
java.lang.String nonce,
java.lang.String nc,
java.lang.String cnonce,
java.lang.String qop,
java.lang.String realm,
java.lang.String md5a2)
Return the Principal associated with the specified username, which matches the digest calculated using the given parameters using the method described in RFC 2069; otherwise return null. |
java.security.Principal |
authenticate(java.security.cert.X509Certificate[] certs)
Return the Principal associated with the specified chain of X509 client certificates. |
boolean |
commit()
Phase 2 of authenticating a Subject when Phase 1
was successful. |
Container |
getContainer()
Return the Container with which this Realm has been associated. |
java.lang.String |
getInfo()
Return descriptive information about this Realm implementation and the corresponding version number, in the format <description>/<version>. |
boolean |
hasRole(java.security.Principal principal,
java.lang.String role)
Return true if the specified Principal has the specified
security role, within the context of this Realm; otherwise return
false. |
void |
initialize(javax.security.auth.Subject subject,
javax.security.auth.callback.CallbackHandler callbackHandler,
java.util.Map sharedState,
java.util.Map options)
Initialize this LoginModule with the specified
configuration information. |
protected void |
load()
Load the contents of our configuration file. |
protected void |
log(java.lang.String message)
Log a message. |
protected void |
log(java.lang.String message,
java.lang.Throwable exception)
Log a message and associated exception. |
boolean |
login()
Phase 1 of authenticating a Subject. |
boolean |
logout()
Log out this user. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a property change listener from this component. |
void |
setContainer(Container container)
Set the Container with which this Realm has been associated. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected javax.security.auth.callback.CallbackHandler callbackHandler
protected boolean committed
commit() returned successfully?
protected boolean debug
protected java.util.Map options
LoginModule.
protected java.lang.String pathname
protected java.security.Principal principal
Principal identified by our validation, or
null if validation falied.
protected java.util.HashMap principals
Principals loaded from our configuration file.
protected java.util.Map sharedState
LoginModule instances.
protected javax.security.auth.Subject subject
| Constructor Detail |
public JAASMemoryLoginModule()
| Method Detail |
public boolean abort()
throws javax.security.auth.login.LoginException
Subject when Phase 1
fails. This method is called if the LoginContext
failed somewhere in the overall authentication chain.
abort in interface javax.security.auth.spi.LoginModuletrue if this method succeeded, or
false if this LoginModule should be
ignored
javax.security.auth.login.LoginException - if the abort fails
public boolean commit()
throws javax.security.auth.login.LoginException
Subject when Phase 1
was successful. This method is called if the LoginContext
succeeded in the overall authentication chain.
commit in interface javax.security.auth.spi.LoginModuletrue if the authentication succeeded, or
false if this LoginModule should be
ignored
javax.security.auth.login.LoginException - if the commit fails
public void initialize(javax.security.auth.Subject subject,
javax.security.auth.callback.CallbackHandler callbackHandler,
java.util.Map sharedState,
java.util.Map options)
LoginModule with the specified
configuration information.
initialize in interface javax.security.auth.spi.LoginModulesubject - The Subject to be authenticatedcallbackHandler - A CallbackHandler for communicating
with the end user as necessarysharedState - State information shared with other
LoginModule instancesoptions - Configuration information for this specific
LoginModule instance
public boolean login()
throws javax.security.auth.login.LoginException
Subject.
login in interface javax.security.auth.spi.LoginModuletrue if the authentication succeeded, or
false if this LoginModule should be
ignored
javax.security.auth.login.LoginException - if the authentication fails
public boolean logout()
throws javax.security.auth.login.LoginException
logout in interface javax.security.auth.spi.LoginModuletrue in all cases because thie
LoginModule should not be ignored
javax.security.auth.login.LoginException - if logging out failedpublic Container getContainer()
getContainer in interface Realmpublic void setContainer(Container container)
setContainer in interface Realmcontainer - The associated Containerpublic java.lang.String getInfo()
<description>/<version>.
getInfo in interface Realmpublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener in interface Realmlistener - The listener to add
public java.security.Principal authenticate(java.lang.String username,
java.lang.String credentials)
null.
authenticate in interface Realmusername - Username of the Principal to look upcredentials - Password or other credentials to use in
authenticating this username
public java.security.Principal authenticate(java.lang.String username,
byte[] credentials)
null.
authenticate in interface Realmusername - Username of the Principal to look upcredentials - Password or other credentials to use in
authenticating this username
public java.security.Principal authenticate(java.lang.String username,
java.lang.String digest,
java.lang.String nonce,
java.lang.String nc,
java.lang.String cnonce,
java.lang.String qop,
java.lang.String realm,
java.lang.String md5a2)
null.
authenticate in interface Realmusername - Username of the Principal to look updigest - Digest which has been submitted by the clientnonce - Unique (or supposedly unique) token which has been used
for this requestrealm - Realm namemd5a2 - Second MD5 digest used to calculate the digest :
MD5(Method + ":" + uri)public java.security.Principal authenticate(java.security.cert.X509Certificate[] certs)
null.
authenticate in interface Realmcerts - Array of client certificates, with the first one in
the array being the certificate of the client itself.
public boolean hasRole(java.security.Principal principal,
java.lang.String role)
true if the specified Principal has the specified
security role, within the context of this Realm; otherwise return
false.
hasRole in interface Realmprincipal - Principal for whom the role is to be checkedrole - Security role to be checkedpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener in interface Realmlistener - The listener to removeprotected void load()
protected void log(java.lang.String message)
message - The message to be logged
protected void log(java.lang.String message,
java.lang.Throwable exception)
message - The message to be loggedexception - The associated exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||