javax.management.MBeanRegistration, javax.security.auth.spi.LoginModule, Contained, JmxEnabled, Lifecycle, Realmpublic class JAASMemoryLoginModule extends MemoryRealm implements javax.security.auth.spi.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.
This class recognizes the following string-valued options, which are
specified in the configuration file and passed to initialize(Subject, CallbackHandler, Map, Map) in the options
argument:
MemoryRealm. The default value matches the MemoryRealm
default.MessageDigestCredentialHandler will be used.CredentialHandler. For example, algorithm=SHA256
would result in a call to MessageDigestCredentialHandler.setAlgorithm(String) with a parameter of
"SHA256"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.
Lifecycle.SingleUseRealmBase.AllRolesMode| Modifier and Type | Field | Description |
|---|---|---|
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 java.util.Map<java.lang.String,?> |
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 failed. |
protected java.util.Map<java.lang.String,?> |
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.
|
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_EVENTmserverallRolesMode, container, containerLog, realmPath, sm, stripRealmForGss, support, validate, x509UsernameRetriever, x509UsernameRetrieverClassName| Constructor | Description |
|---|---|
JAASMemoryLoginModule() |
| Modifier and Type | Method | 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(javax.security.auth.Subject subject,
javax.security.auth.callback.CallbackHandler callbackHandler,
java.util.Map<java.lang.String,?> sharedState,
java.util.Map<java.lang.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.
|
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stopdestroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregisterauthenticate, getDigester, getPassword, getPathname, getPrincipal, setPathname, startInternalclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisAvailableaddPropertyChangeListener, authenticate, authenticate, authenticate, authenticate, backgroundProcess, findSecurityConstraints, getAllRolesMode, getContainer, getCredentialHandler, getDigest, getDomainInternal, getObjectNameKeyProperties, getPrincipal, getPrincipal, getRealmPath, getRealmSuffix, getRoles, getServer, getTransportGuaranteeRedirectStatus, getValidate, getX509UsernameRetrieverClassName, hasMessageDigest, hasResourcePermission, hasRole, hasRoleInternal, hasUserDataPermission, initInternal, isStripRealmForGss, main, removePropertyChangeListener, setAllRolesMode, setContainer, setCredentialHandler, setRealmPath, setStripRealmForGss, setTransportGuaranteeRedirectStatus, setValidate, setX509UsernameRetrieverClassName, stopInternal, toStringprotected javax.security.auth.callback.CallbackHandler callbackHandler
protected boolean committed
commit() returned successfully?protected java.util.Map<java.lang.String,?> options
LoginModule.protected java.lang.String pathname
protected java.security.Principal principal
Principal identified by our validation, or
null if validation failed.protected java.util.Map<java.lang.String,?> sharedState
LoginModule instances.protected javax.security.auth.Subject subject
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
ignoredjavax.security.auth.login.LoginException - if the abort failspublic 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
ignoredjavax.security.auth.login.LoginException - if the commit failspublic void initialize(javax.security.auth.Subject subject,
javax.security.auth.callback.CallbackHandler callbackHandler,
java.util.Map<java.lang.String,?> sharedState,
java.util.Map<java.lang.String,?> 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 instancepublic 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
ignoredjavax.security.auth.login.LoginException - if the authentication failspublic boolean logout()
throws javax.security.auth.login.LoginException
logout in interface javax.security.auth.spi.LoginModuletrue in all cases because the
LoginModule should not be ignoredjavax.security.auth.login.LoginException - if logging out failedprotected void load()
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.