Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

net.sf.acegisecurity.adapters.jboss
Class JbossAcegiLoginModule  view JbossAcegiLoginModule download JbossAcegiLoginModule.java

java.lang.Object
  extended byorg.jboss.security.auth.spi.AbstractServerLoginModule
      extended bynet.sf.acegisecurity.adapters.jboss.JbossAcegiLoginModule
All Implemented Interfaces:
javax.security.auth.spi.LoginModule

public class JbossAcegiLoginModule
extends org.jboss.security.auth.spi.AbstractServerLoginModule

Adapter to enable JBoss to authenticate via the Acegi Security System for Spring.

Returns a net.sf.acegisecurity.adapters.PrincipalAcegiUserToken to JBoss' authentication system, which is subsequently available from java:comp/env/security/subject.

Version:
$Id: JbossAcegiLoginModule.java,v 1.7 2005/02/28 02:41:13 benalex Exp $

Field Summary
private  net.sf.acegisecurity.AuthenticationManager authenticationManager
           
private  char[] credential
           
private  java.security.Principal identity
           
private  java.lang.String key
           
 
Fields inherited from class org.jboss.security.auth.spi.AbstractServerLoginModule
callbackHandler, log, loginOk, options, sharedState, subject, useFirstPass
 
Constructor Summary
JbossAcegiLoginModule()
           
 
Method Summary
protected  java.security.Principal getIdentity()
          Overriden by subclasses to return the Principal that corresponds to the user primary identity.
protected  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.lang.String[] getUsernameAndPassword()
           
 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.
 
Methods inherited from class org.jboss.security.auth.spi.AbstractServerLoginModule
abort, commit, createGroup, getUseFirstPass, logout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

authenticationManager

private net.sf.acegisecurity.AuthenticationManager authenticationManager

identity

private java.security.Principal identity

key

private java.lang.String key

credential

private char[] credential
Constructor Detail

JbossAcegiLoginModule

public JbossAcegiLoginModule()
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)
Description copied from class: org.jboss.security.auth.spi.AbstractServerLoginModule
Initialize the login module. This stores the subject, callbackHandler and sharedState and options for the login session. Subclasses should override if they need to process their own options. A call to super.initialize(...) must be made in the case of an override.

The options are checked for the password-stacking parameter. If this is set to "useFirstPass", the login identity will be taken from the javax.security.auth.login.name value of the sharedState map, and the proof of identity from the javax.security.auth.login.password value of the sharedState map.


login

public boolean login()
              throws javax.security.auth.login.LoginException
Description copied from class: org.jboss.security.auth.spi.AbstractServerLoginModule
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. If they do not or are null this method returns false. Note that subclasses that override the login method must set the loginOk ivar to true if the login succeeds in order for the commit phase to populate the Subject. This implementation sets loginOk to true if the login() method returns true, otherwise, it sets loginOk to false.


getIdentity

protected java.security.Principal getIdentity()
Description copied from class: org.jboss.security.auth.spi.AbstractServerLoginModule
Overriden by subclasses to return the Principal that corresponds to the user primary identity.


getRoleSets

protected java.security.acl.Group[] getRoleSets()
                                         throws javax.security.auth.login.LoginException
Description copied from class: org.jboss.security.auth.spi.AbstractServerLoginModule
Overriden by subclasses to return the Groups that correspond to the to the role sets assigned to the user. Subclasses should create at least a Group named "Roles" that contains the roles assigned to the user. A second common group is "CallerPrincipal" that provides the application identity of the user rather than the security domain identity.


getUsernameAndPassword

protected java.lang.String[] getUsernameAndPassword()
                                             throws javax.security.auth.login.LoginException