org.apache.catalina.realm
Class JAASMemoryLoginModule
- LoginModule, Lifecycle, MBeanRegistration, Realm
public class JAASMemoryLoginModule
implements LoginModule, Realm
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:
- debug - Set to "true" to get debugging messages
generated to System.out. The default value is
false.
- pathname - Relative (to the pathname specified by the
"catalina.base" system property) or absolute pahtname to the
XML file containing our user information, in the format supported by
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.
Version:
- Craig R. McClanahan
protected 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 Map | options- The configuration information for this
LoginModule.
|
protected String | pathname- The absolute or relative pathname to the XML configuration file.
|
protected Principal | principal- The
Principal identified by our validation, or
null if validation falied.
|
protected HashMap | principals- The set of
Principals loaded from our configuration file.
|
protected Map | sharedState- The state information that is shared with other configured
LoginModule instances.
|
protected static StringManager | sm- The string manager for this package.
|
protected Subject | subject- The subject for which we are performing authentication.
|
container, controller, debug, digest, digestEncoding, domain, host, info, initialized, lifecycle, md, md5Encoder, md5Helper, mserver, oname, path, sm, started, support, type, validate |
boolean | abort()- Phase 2 of authenticating a
Subject when Phase 1
fails.
|
boolean | commit()- Phase 2 of authenticating a
Subject when Phase 1
was successful.
|
SecurityConstraint[] | findSecurityConstraints(HttpRequest request, Context context)- Return the SecurityConstraints configured to guard the request URI for
this request, or
null if there is no such constraint.
|
void | initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options)- Initialize this
LoginModule with the specified
configuration information.
|
protected void | load()- Load the contents of our configuration file.
|
boolean | login()- Phase 1 of authenticating a
Subject.
|
boolean | logout()- Log out this user.
|
authenticate, getDigester, getInfo, getName, getPassword, getPathname, getPrincipal, getPrincipals, setPathname, start, stop |
Digest, addLifecycleListener, addPropertyChangeListener, authenticate, authenticate, authenticate, authenticate, destroy, digest, findLifecycleListeners, findSecurityConstraints, getContainer, getController, getDebug, getDigest, getDigest, getDigestEncoding, getDomain, getInfo, getName, getObjectName, getPassword, getPrincipal, getType, getValidate, hasMessageDigest, hasResourcePermission, hasRole, hasUserDataPermission, init, log, log, main, postDeregister, postRegister, preDeregister, preRegister, removeLifecycleListener, removePropertyChangeListener, setContainer, setController, setDebug, setDigest, setDigestEncoding, setValidate, start, stop |
callbackHandler
protected CallbackHandler callbackHandler
The callback handler responsible for answering our requests.
committed
protected boolean committed
Has our own commit() returned successfully?
debug
protected boolean debug
Should we log debugging messages?
options
protected Map options
The configuration information for this LoginModule.
pathname
protected String pathname
The absolute or relative pathname to the XML configuration file.
principal
protected Principal principal
The Principal identified by our validation, or
null if validation falied.
principals
protected HashMap principals
The set of Principals loaded from our configuration file.
sharedState
protected Map sharedState
The state information that is shared with other configured
LoginModule instances.
sm
protected static StringManager sm
The string manager for this package.
subject
protected Subject subject
The subject for which we are performing authentication.
JAASMemoryLoginModule
public JAASMemoryLoginModule()
abort
public boolean abort()
throws LoginException Phase 2 of authenticating a Subject when Phase 1
fails. This method is called if the LoginContext
failed somewhere in the overall authentication chain.
true if this method succeeded, or
false if this LoginModule should be
ignored
commit
public boolean commit()
throws LoginException Phase 2 of authenticating a Subject when Phase 1
was successful. This method is called if the LoginContext
succeeded in the overall authentication chain.
true if the authentication succeeded, or
false if this LoginModule should be
ignored
findSecurityConstraints
public SecurityConstraint[] findSecurityConstraints(HttpRequest request,
Context context) Return the SecurityConstraints configured to guard the request URI for
this request, or null if there is no such constraint.
- findSecurityConstraints in interface Realm
- findSecurityConstraints in interface RealmBase
request - Request we are processingcontext - Context the Request is mapped to
initialize
public void initialize(Subject subject,
CallbackHandler callbackHandler,
Map sharedState,
Map options) Initialize this LoginModule with the specified
configuration information.
subject - 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
load
protected void load()
Load the contents of our configuration file.
login
public boolean login()
throws LoginException Phase 1 of authenticating a Subject.
true if the authentication succeeded, or
false if this LoginModule should be
ignored
logout
public boolean logout()
throws LoginException Log out this user.
true in all cases because thie
LoginModule should not be ignored
Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.