JSecurity

org.jsecurity.authc.pam
Class FirstSuccessfulAuthenticationStrategy

java.lang.Object
  extended by org.jsecurity.authc.pam.AbstractAuthenticationStrategy
      extended by org.jsecurity.authc.pam.FirstSuccessfulAuthenticationStrategy
All Implemented Interfaces:
ModularAuthenticationStrategy

public class FirstSuccessfulAuthenticationStrategy
extends AbstractAuthenticationStrategy

ModularAuthenticationStrategy implementation that only accepts the account data from the first successfully consulted Realm and ignores all subsequent realms.

Since:
0.9
Author:
Les Hazlewood

Constructor Summary
FirstSuccessfulAuthenticationStrategy()
           
 
Method Summary
 AuthenticationInfo beforeAllAttempts(Collection<? extends Realm> realms, AuthenticationToken token)
          Method invoked by the ModularAuthenticator signifying that the authentication process is about to begin for the specified token - called before any Realm is actually invoked.
protected  AuthenticationInfo merge(AuthenticationInfo info, AuthenticationInfo aggregate)
           
 
Methods inherited from class org.jsecurity.authc.pam.AbstractAuthenticationStrategy
afterAllAttempts, afterAttempt, beforeAttempt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FirstSuccessfulAuthenticationStrategy

public FirstSuccessfulAuthenticationStrategy()
Method Detail

beforeAllAttempts

public AuthenticationInfo beforeAllAttempts(Collection<? extends Realm> realms,
                                            AuthenticationToken token)
                                     throws AuthenticationException
Description copied from interface: ModularAuthenticationStrategy
Method invoked by the ModularAuthenticator signifying that the authentication process is about to begin for the specified token - called before any Realm is actually invoked.

The AuthenticationInfo object returned from this method is essentially an empty place holder for aggregating account data across multiple realms. It should be populated by the realms over the course of the authentication attempt across the multiple realms. It will be passed into the ModularAuthenticationStrategy.beforeAttempt(org.jsecurity.realm.Realm, org.jsecurity.authc.AuthenticationToken, org.jsecurity.authc.AuthenticationInfo) calls, allowing inspection of the aggregated account data up to that point in the multi-realm authentication, allowing any logic to be executed accordingly.

Specified by:
beforeAllAttempts in interface ModularAuthenticationStrategy
Overrides:
beforeAllAttempts in class AbstractAuthenticationStrategy
Parameters:
realms - the Realms that will be consulted during the authentication process for the specified token.
token - the Principal/Credential representation to be used during authentication for a corresponding subject.
Returns:
an empty AuthenticationInfo object that will populated with data from multiple realms.
Throws:
AuthenticationException - if the strategy implementation does not wish the Authentication attempt to execute.

merge

protected AuthenticationInfo merge(AuthenticationInfo info,
                                   AuthenticationInfo aggregate)
Overrides:
merge in class AbstractAuthenticationStrategy

JSecurity

Copyright © 2004-2008 JSecurity.