public abstract class AbstractServerLoginModule extends Object implements LoginModule
You may also wish to override
public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options)In which case the first line of your initialize() method should be:
super.initialize(subject, callbackHandler, sharedState, options);
You may also wish to override
public boolean login() throws LoginExceptionIn which case the last line of your login() method should be
return super.login();
Modifier and Type | Field and Description |
---|---|
protected CallbackHandler |
callbackHandler |
protected String |
jbossModuleName
jboss module name to load Callback class etc
|
protected Logger |
log |
protected boolean |
loginOk
Flag indicating if the login phase succeeded.
|
protected Map |
options |
protected String |
principalClassModuleName |
protected String |
principalClassName
An optional custom Principal class implementation
|
protected Map |
sharedState |
protected Subject |
subject |
protected Principal |
unauthenticatedIdentity
the principal to use when a null username and password are seen
|
protected boolean |
useFirstPass
Flag indicating if the shared credential should be used
|
Constructor and Description |
---|
AbstractServerLoginModule() |
Modifier and Type | Method and Description |
---|---|
boolean |
abort()
Method to abort the authentication process (phase 2).
|
protected void |
addValidOptions(String[] moduleValidOptions)
Each subclass should call this from within their initialize method BEFORE calling super.initialize()
The base class will then check the options
|
protected void |
checkOptions()
checks the collected valid options against the options passed in
Override when there are special needs like for the SimpleUsersLoginModule
|
boolean |
commit()
Method to commit the authentication process (phase 2).
|
protected Group |
createGroup(String name,
Set<Principal> principals)
Find or create a Group with the given name.
|
protected Principal |
createIdentity(String username)
Utility method to create a Principal for the given username.
|
protected Group |
getCallerPrincipalGroup(Set<Principal> principals) |
protected abstract Principal |
getIdentity()
Overriden by subclasses to return the Principal that corresponds to
the user primary identity.
|
protected abstract Group[] |
getRoleSets()
Overriden by subclasses to return the Groups that correspond to the
to the role sets assigned to the user.
|
protected Principal |
getUnauthenticatedIdentity() |
protected boolean |
getUseFirstPass() |
void |
initialize(Subject subject,
CallbackHandler callbackHandler,
Map<String,?> sharedState,
Map<String,?> options)
Initialize the login module.
|
boolean |
login()
Looks for javax.security.auth.login.name and javax.security.auth.login.password
values in the sharedState map if the useFirstPass option was true and returns
true if they exist.
|
boolean |
logout()
Remove the user identity and roles added to the Subject during commit.
|
protected Subject subject
protected CallbackHandler callbackHandler
protected Map sharedState
protected Map options
protected boolean useFirstPass
protected boolean loginOk
protected String principalClassName
protected String principalClassModuleName
protected Principal unauthenticatedIdentity
protected String jbossModuleName
protected Logger log
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String,?> sharedState, Map<String,?> options)
initialize
in interface LoginModule
subject
- the Subject to update after a successful login.callbackHandler
- the CallbackHandler that will be used to obtain the
the user identity and credentials.sharedState
- a Map shared between all configured login module instancesoptions
- the parameters passed to the login module.public boolean login() throws LoginException
login
in interface LoginModule
LoginException
public boolean commit() throws LoginException
commit
in interface LoginModule
LoginException
Subject;
,
Group;
public boolean abort() throws LoginException
abort
in interface LoginModule
LoginException
public boolean logout() throws LoginException
logout
in interface LoginModule
LoginException
protected abstract Principal getIdentity()
protected abstract Group[] getRoleSets() throws LoginException
LoginException
protected boolean getUseFirstPass()
protected Principal getUnauthenticatedIdentity()
protected Group createGroup(String name, Set<Principal> principals)
protected Principal createIdentity(String username) throws Exception
username
- the name of the principalException
- thrown if the custom principal type cannot be created.protected void addValidOptions(String[] moduleValidOptions)
moduleValidOptions
- : the list of options the subclass supportsprotected void checkOptions()
Copyright © 2016 JBoss by Red Hat. All rights reserved.