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

Quick Search    Search Deep

org.acegisecurity.providers.jaas
Class SecurityContextLoginModule  view SecurityContextLoginModule download SecurityContextLoginModule.java

java.lang.Object
  extended byorg.acegisecurity.providers.jaas.SecurityContextLoginModule
All Implemented Interfaces:
javax.security.auth.spi.LoginModule

public class SecurityContextLoginModule
extends java.lang.Object
implements javax.security.auth.spi.LoginModule

An implementation of javax.security.auth.spi.LoginModule that uses an Acegi Security SecurityContext to provide authentication.
This LoginModule provides opposite functionality to the JaasAuthenticationProvider API, and should not really be used in conjunction with it.
The JaasAuthenticationProvider allows Acegi to authenticate against Jaas.
The SecurityContextLoginModule allows a Jaas based application to authenticate against Acegi. If there is no Authentication in the SecurityContextHolder the login() method will throw a LoginException by default. This functionality can be changed with the ignoreMissingAuthentication option by setting it to "true". Setting ignoreMissingAuthentication=true will tell the SecurityContextLoginModule to simply return false and be ignored if the authentication is null.


Field Summary
private  org.acegisecurity.Authentication authen
           
private  boolean ignoreMissingAuthentication
           
private static org.apache.commons.logging.Log log
           
private  javax.security.auth.Subject subject
           
 
Constructor Summary
SecurityContextLoginModule()
           
 
Method Summary
 boolean abort()
          Abort the authentication process by forgetting the Acegi Security Authentication.
 boolean commit()
          Authenticate the Subject (phase two) by adding the Acegi Security Authentication to the Subject's principals.
(package private)  org.acegisecurity.Authentication getAuthentication()
           
(package private)  javax.security.auth.Subject getSubject()
           
 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()
          Authenticate the Subject (phase one) by extracting the Acegi Security Authentication from the current SecurityContext.
 boolean logout()
          Log out the Subject.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

authen

private org.acegisecurity.Authentication authen

subject

private javax.security.auth.Subject subject

ignoreMissingAuthentication

private boolean ignoreMissingAuthentication
Constructor Detail

SecurityContextLoginModule

public SecurityContextLoginModule()
Method Detail

abort

public boolean abort()
              throws javax.security.auth.login.LoginException
Abort the authentication process by forgetting the Acegi Security Authentication.

Specified by:
abort in interface javax.security.auth.spi.LoginModule

commit

public boolean commit()
               throws javax.security.auth.login.LoginException
Authenticate the Subject (phase two) by adding the Acegi Security Authentication to the Subject's principals.

Specified by:
commit in interface javax.security.auth.spi.LoginModule

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. Ignores the callback handler, since the code establishing the LoginContext likely won't provide one that understands Acegi Security. Also ignores the sharedState and options parameters, since none are recognized.

Specified by:
initialize in interface javax.security.auth.spi.LoginModule

login

public boolean login()
              throws javax.security.auth.login.LoginException
Authenticate the Subject (phase one) by extracting the Acegi Security Authentication from the current SecurityContext.

Specified by:
login in interface javax.security.auth.spi.LoginModule

logout

public boolean logout()
               throws javax.security.auth.login.LoginException
Log out the Subject.

Specified by:
logout in interface javax.security.auth.spi.LoginModule

getAuthentication

org.acegisecurity.Authentication getAuthentication()

getSubject

javax.security.auth.Subject getSubject()