|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.security.auth.spi.AbstractServerLoginModule
org.jboss.security.auth.spi.UsernamePasswordLoginModule
An abstract subclass of AbstractServerLoginModule that imposes an identity == String username, credentials == String password view on the login process.
Subclasses override the getUsersPassword()
and getRoleSets()
methods to return the expected password and roles
for the user.
getUsername()
,
getUsersPassword()
,
AbstractServerLoginModule.getRoleSets()
,
AbstractServerLoginModule.createIdentity(String)
Field Summary |
Fields inherited from class org.jboss.security.auth.spi.AbstractServerLoginModule |
callbackHandler, log, loginOk, options, principalClassName, sharedState, subject, unauthenticatedIdentity, useFirstPass |
Constructor Summary | |
UsernamePasswordLoginModule()
|
Method Summary | |
protected String |
createPasswordHash(String username,
String password)
If hashing is enabled, this method is called from login()
prior to password validation. |
protected Object |
getCredentials()
|
protected Principal |
getIdentity()
Overriden by subclasses to return the Principal that corresponds to the user primary identity. |
protected Principal |
getUnauthenticatedIdentity()
|
protected String |
getUsername()
|
protected String[] |
getUsernameAndPassword()
Called by login() to acquire the username and password strings for authentication. |
protected abstract String |
getUsersPassword()
Get the expected password for the current username available via the getUsername() method. |
void |
initialize(Subject subject,
CallbackHandler callbackHandler,
Map sharedState,
Map options)
Override the superclass method to look for the following options after first invoking the super version. |
boolean |
login()
Perform the authentication of the username and password. |
protected boolean |
validatePassword(String inputPassword,
String expectedPassword)
A hook that allows subclasses to change the validation of the input password against the expected password. |
Methods inherited from class org.jboss.security.auth.spi.AbstractServerLoginModule |
abort, commit, createGroup, createIdentity, getRoleSets, getUseFirstPass, logout |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public UsernamePasswordLoginModule()
Method Detail |
public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options)
initialize
in interface LoginModule
initialize
in class AbstractServerLoginModule
options
- :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 instancespublic boolean login() throws LoginException
login
in interface LoginModule
login
in class AbstractServerLoginModule
LoginException
protected Principal getIdentity()
AbstractServerLoginModule
getIdentity
in class AbstractServerLoginModule
protected Principal getUnauthenticatedIdentity()
getUnauthenticatedIdentity
in class AbstractServerLoginModule
protected Object getCredentials()
protected String getUsername()
protected String[] getUsernameAndPassword() throws LoginException
LoginException
- thrown if CallbackHandler is not set or fails.protected String createPasswordHash(String username, String password)
login()
prior to password validation.
Subclasses may override it to provide customized password hashing, for example by adding user-specific information or salting.
The default version calculates the hash based on the following options:
validatePassword()
to fail.
username
- ignored in default versionpassword
- the password string to be hashed
SecurityException
- - thrown if there is a failure to load the
digestCallbackprotected boolean validatePassword(String inputPassword, String expectedPassword)
protected abstract String getUsersPassword() throws LoginException
LoginException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |