public class JAASMemoryLoginModule extends MemoryRealm implements LoginModule
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.
RealmBase.AllRolesMode
Lifecycle.SingleUse
Modifier and Type | Field and Description |
---|---|
protected CallbackHandler |
callbackHandler
The callback handler responsible for answering our requests.
|
protected boolean |
committed
Has our own
commit() returned successfully? |
protected Map<String,?> |
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 failed. |
protected Map<String,?> |
sharedState
The state information that is shared with other configured
LoginModule instances. |
protected Subject |
subject
The subject for which we are performing authentication.
|
info, name
allRolesMode, container, containerLog, digest, digestEncoding, md, md5Encoder, md5Helper, realmPath, sm, stripRealmForGss, support, validate, x509UsernameRetriever, x509UsernameRetrieverClassName
mserver
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
Constructor and Description |
---|
JAASMemoryLoginModule() |
Modifier and Type | Method and Description |
---|---|
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. |
void |
initialize(Subject subject,
CallbackHandler callbackHandler,
Map<String,?> sharedState,
Map<String,?> 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, startInternal
addPropertyChangeListener, authenticate, authenticate, authenticate, authenticate, authenticate, backgroundProcess, compareCredentials, digest, Digest, findSecurityConstraints, getAllRolesMode, getContainer, getDigest, getDigest, getDigestCharset, getDigestEncoding, getDomainInternal, getObjectNameKeyProperties, getPrincipal, getPrincipal, getPrincipal, getRealmPath, getRealmSuffix, getServer, getTransportGuaranteeRedirectStatus, getValidate, getX509UsernameRetrieverClassName, hasMessageDigest, hasResourcePermission, hasRole, hasUserDataPermission, initInternal, isStripRealmForGss, main, removePropertyChangeListener, setAllRolesMode, setContainer, setDigest, setDigestEncoding, setRealmPath, setStripRealmForGss, setTransportGuaranteeRedirectStatus, setValidate, setX509UsernameRetrieverClassName, stopInternal, toString
destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
protected CallbackHandler callbackHandler
protected boolean committed
commit()
returned successfully?protected String pathname
protected Principal principal
Principal
identified by our validation, or
null
if validation failed.protected Map<String,?> sharedState
LoginModule
instances.protected Subject subject
public boolean abort() throws LoginException
Subject
when Phase 1
fails. This method is called if the LoginContext
failed somewhere in the overall authentication chain.abort
in interface LoginModule
true
if this method succeeded, or
false
if this LoginModule
should be
ignoredLoginException
- if the abort failspublic boolean commit() throws LoginException
Subject
when Phase 1
was successful. This method is called if the LoginContext
succeeded in the overall authentication chain.commit
in interface LoginModule
true
if the authentication succeeded, or
false
if this LoginModule
should be
ignoredLoginException
- if the commit failspublic void initialize(Subject subject, CallbackHandler callbackHandler, Map<String,?> sharedState, Map<String,?> options)
LoginModule
with the specified
configuration information.initialize
in interface LoginModule
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
instancepublic boolean login() throws LoginException
Subject
.login
in interface LoginModule
true
if the authentication succeeded, or
false
if this LoginModule
should be
ignoredLoginException
- if the authentication failspublic boolean logout() throws LoginException
logout
in interface LoginModule
true
in all cases because the
LoginModule
should not be ignoredLoginException
- if logging out failedprotected void load()
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.