|
||||||||||
PREV CLASS NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.security.auth.spi.AbstractServerLoginModule
This class implements the common functionality required for a JAAS server side LoginModule and implements the JBossSX standard Subject usage pattern of storing identities and roles. Subclass this module to create your own custom LoginModule and override the login(), getRoleSets() and getIdentity() methods.
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();
Field Summary | |
protected javax.security.auth.callback.CallbackHandler |
callbackHandler
|
protected Logger (src) |
log
|
protected boolean |
loginOk
Flag indicating if the login phase succeeded. |
protected java.util.Map |
options
|
protected java.lang.String |
principalClassName
An optional custom Principal class implementation |
protected java.util.Map |
sharedState
|
protected javax.security.auth.Subject |
subject
|
protected java.security.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 Summary | |
AbstractServerLoginModule()
|
Method Summary | |
boolean |
abort()
Method to abort the authentication process (phase 2). |
boolean |
commit()
Method to commit the authentication process (phase 2). |
protected java.security.acl.Group |
createGroup(java.lang.String name,
java.util.Set principals)
Find or create a Group with the given name. |
protected java.security.Principal |
createIdentity(java.lang.String username)
Utility method to create a Principal for the given username. |
protected abstract java.security.Principal |
getIdentity()
Overriden by subclasses to return the Principal that corresponds to the user primary identity. |
protected abstract java.security.acl.Group[] |
getRoleSets()
Overriden by subclasses to return the Groups that correspond to the to the role sets assigned to the user. |
protected java.security.Principal |
getUnauthenticatedIdentity()
|
protected boolean |
getUseFirstPass()
|
void |
initialize(javax.security.auth.Subject subject,
javax.security.auth.callback.CallbackHandler callbackHandler,
java.util.Map sharedState,
java.util.Map 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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected javax.security.auth.Subject subject
protected javax.security.auth.callback.CallbackHandler callbackHandler
protected java.util.Map sharedState
protected java.util.Map options
protected Logger (src) log
protected boolean useFirstPass
protected boolean loginOk
protected java.lang.String principalClassName
protected java.security.Principal unauthenticatedIdentity
Constructor Detail |
public AbstractServerLoginModule()
Method Detail |
public void initialize(javax.security.auth.Subject subject, javax.security.auth.callback.CallbackHandler callbackHandler, java.util.Map sharedState, java.util.Map options)
initialize
in interface javax.security.auth.spi.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 javax.security.auth.login.LoginException
login
in interface javax.security.auth.spi.LoginModule
javax.security.auth.login.LoginException
public boolean commit() throws javax.security.auth.login.LoginException
commit
in interface javax.security.auth.spi.LoginModule
javax.security.auth.login.LoginException
javax.security.auth.Subject;
,
java.security.acl.Group;
public boolean abort() throws javax.security.auth.login.LoginException
abort
in interface javax.security.auth.spi.LoginModule
javax.security.auth.login.LoginException
public boolean logout() throws javax.security.auth.login.LoginException
logout
in interface javax.security.auth.spi.LoginModule
javax.security.auth.login.LoginException
protected abstract java.security.Principal getIdentity()
protected abstract java.security.acl.Group[] getRoleSets() throws javax.security.auth.login.LoginException
javax.security.auth.login.LoginException
protected boolean getUseFirstPass()
protected java.security.Principal getUnauthenticatedIdentity()
protected java.security.acl.Group createGroup(java.lang.String name, java.util.Set principals)
protected java.security.Principal createIdentity(java.lang.String username) throws java.lang.Exception
username
- the name of the principal
java.lang.Exception
- thrown if the custom principal type cannot be created.
|
||||||||||
PREV CLASS NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |