org.jboss.security.auth.spi
Class XMLLoginModule

java.lang.Object
  extended byorg.jboss.security.auth.spi.AbstractServerLoginModule (src) 
      extended byorg.jboss.security.auth.spi.UsernamePasswordLoginModule (src) 
          extended byorg.jboss.security.auth.spi.XMLLoginModule
All Implemented Interfaces:
javax.security.auth.spi.LoginModule

public class XMLLoginModule
extends UsernamePasswordLoginModule (src)

A login module that obtains its security information directly from its login module options. The name of the login module comes from the use of the login-config.xml descriptor which allows the user/roles content to be embedded directly in the login module configuration. The following login-config.xml fragment illustrates an example: ... guest


Field Summary
 
Fields inherited from class org.jboss.security.auth.spi.AbstractServerLoginModule (src)
callbackHandler, log, loginOk, options, principalClassName, sharedState, subject, unauthenticatedIdentity, useFirstPass
 
Constructor Summary
XMLLoginModule()
           
 
Method Summary
protected  java.security.acl.Group[] getRoleSets()
          Obtain the various groups of roles for the user
protected  java.lang.String getUsersPassword()
          Get the expected password for the current username available via the getUsername() method.
 void initialize(javax.security.auth.Subject subject, javax.security.auth.callback.CallbackHandler callbackHandler, java.util.Map sharedState, java.util.Map options)
          Initialize this LoginModule.
 boolean login()
          Method to authenticate a Subject (phase 1).
 
Methods inherited from class org.jboss.security.auth.spi.UsernamePasswordLoginModule (src)
createPasswordHash, getCredentials, getIdentity, getUnauthenticatedIdentity, getUsername, getUsernameAndPassword, validatePassword
 
Methods inherited from class org.jboss.security.auth.spi.AbstractServerLoginModule (src)
abort, commit, createGroup, createIdentity, getUseFirstPass, logout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLLoginModule

public XMLLoginModule()
Method Detail

initialize

public void initialize(javax.security.auth.Subject subject,
                       javax.security.auth.callback.CallbackHandler callbackHandler,
                       java.util.Map sharedState,
                       java.util.Map options)
Initialize this LoginModule.

Specified by:
initialize in interface javax.security.auth.spi.LoginModule
Overrides:
initialize in class UsernamePasswordLoginModule (src)
Parameters:
options - - the login module option map. Supported options include: userInfo: The name of the properties resource containing user/passwords. The default is "users.properties"

login

public boolean login()
              throws javax.security.auth.login.LoginException
Method to authenticate a Subject (phase 1). This validates that the users and roles properties files were loaded and then calls super.login to perform the validation of the password.

Specified by:
login in interface javax.security.auth.spi.LoginModule
Overrides:
login in class UsernamePasswordLoginModule (src)
Throws:
javax.security.auth.login.LoginException - thrown if the users or roles properties files were not found or the super.login method fails.

getRoleSets

protected java.security.acl.Group[] getRoleSets()
                                         throws javax.security.auth.login.LoginException
Obtain the various groups of roles for the user

Specified by:
getRoleSets in class AbstractServerLoginModule (src)
Returns:
Group[] containing the sets of roles
Throws:
javax.security.auth.login.LoginException

getUsersPassword

protected java.lang.String getUsersPassword()
Description copied from class: UsernamePasswordLoginModule (src)
Get the expected password for the current username available via the getUsername() method. This is called from within the login() method after the CallbackHandler has returned the username and candidate password.

Specified by:
getUsersPassword in class UsernamePasswordLoginModule (src)
Returns:
the valid password String