public abstract class AbstractLoginModule extends Object implements LoginModule
AbstractLoginModule
provides functionality common to ldap based
login modules.Modifier and Type | Field and Description |
---|---|
protected CallbackHandler |
callbackHandler
Initialized callback handler.
|
protected boolean |
clearPass
Whether credentials should be removed from the shared state map.
|
protected boolean |
commitSuccess
Whether commit was successful.
|
protected Set<LdapCredential> |
credentials
Credentials to add to the subject.
|
protected List<LdapRole> |
defaultRole
Default roles.
|
protected org.apache.commons.logging.Log |
logger
Log for this class.
|
static String |
LOGIN_DN
Constant for entryDn stored in shared state.
|
static String |
LOGIN_NAME
Constant for login name stored in shared state.
|
static String |
LOGIN_PASSWORD
Constant for login password stored in shared state.
|
protected boolean |
loginSuccess
Whether login was successful.
|
protected String |
principalGroupName
Name of group to add all principals to.
|
protected Set<Principal> |
principals
Principals to add to the subject.
|
protected String |
roleGroupName
Name of group to add all roles to.
|
protected Set<Principal> |
roles
Roles to add to the subject.
|
protected boolean |
setLdapCredential
Whether ldap credential data should be set.
|
protected boolean |
setLdapDnPrincipal
Whether ldap dn principal data should be set.
|
protected boolean |
setLdapPrincipal
Whether ldap principal data should be set.
|
protected Map |
sharedState
Shared state from other login module.
|
protected boolean |
storePass
Whether credentials should be stored in the shared state map.
|
protected Subject |
subject
Initialized subject.
|
protected boolean |
tryFirstPass
Whether credentials from the shared state should be used if they are
available.
|
protected boolean |
useFirstPass
Whether credentials from the shared state should be used.
|
Constructor and Description |
---|
AbstractLoginModule() |
Modifier and Type | Method and Description |
---|---|
boolean |
abort() |
protected List<LdapRole> |
attributesToRoles(Attributes attributes)
This parses the supplied attributes and returns them as a list of
LdapRole s. |
protected void |
clearState()
Removes any stateful principals, credentials, or roles stored by login.
|
boolean |
commit() |
static Authenticator |
createAuthenticator(Map<String,?> options)
This constructs a new
Authenticator with the supplied jaas
options. |
static Ldap |
createLdap(Map<String,?> options)
This constructs a new
Ldap with the supplied jaas options. |
protected void |
getCredentials(NameCallback nameCb,
PasswordCallback passCb,
boolean useCallback)
This attempts to retrieve credentials for the supplied name and password
callbacks.
|
void |
initialize(Subject subject,
CallbackHandler callbackHandler,
Map<String,?> sharedState,
Map<String,?> options) |
abstract boolean |
login() |
boolean |
logout() |
protected void |
storeCredentials(NameCallback nameCb,
PasswordCallback passCb,
String loginDn)
This will store the supplied name, password, and entry dn in the stored
state map.
|
public static final String LOGIN_NAME
public static final String LOGIN_DN
public static final String LOGIN_PASSWORD
protected final org.apache.commons.logging.Log logger
protected Subject subject
protected CallbackHandler callbackHandler
protected Map sharedState
protected boolean useFirstPass
protected boolean tryFirstPass
protected boolean storePass
protected boolean clearPass
protected boolean setLdapPrincipal
protected boolean setLdapDnPrincipal
protected boolean setLdapCredential
protected String principalGroupName
protected String roleGroupName
protected boolean loginSuccess
protected boolean commitSuccess
protected Set<LdapCredential> credentials
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String,?> sharedState, Map<String,?> options)
initialize
in interface LoginModule
public abstract boolean login() throws LoginException
login
in interface LoginModule
LoginException
public boolean commit() throws LoginException
commit
in interface LoginModule
LoginException
public boolean abort() throws LoginException
abort
in interface LoginModule
LoginException
public boolean logout() throws LoginException
logout
in interface LoginModule
LoginException
public static Ldap createLdap(Map<String,?> options)
Ldap
with the supplied jaas options.options
- Map
Ldap
public static Authenticator createAuthenticator(Map<String,?> options)
Authenticator
with the supplied jaas
options.options
- Map
Authenticator
protected void clearState()
protected void getCredentials(NameCallback nameCb, PasswordCallback passCb, boolean useCallback) throws LoginException
nameCb
- to set name forpassCb
- to set password foruseCallback
- whether to force a callback handlerLoginException
- if the callback handler failsprotected void storeCredentials(NameCallback nameCb, PasswordCallback passCb, String loginDn)
nameCb
- to storepassCb
- to storeloginDn
- to storeprotected List<LdapRole> attributesToRoles(Attributes attributes) throws NamingException
LdapRole
s.attributes
- Attributes
List
NamingException
- if the attributes cannot be parsedCopyright © 2019. All rights reserved.