JSecurity

org.jsecurity.authc.pam
Class AllSuccessfulModularAuthenticationStrategy

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

public class AllSuccessfulModularAuthenticationStrategy
extends AbstractAuthenticationStrategy

ModularAuthenticationStrategy implementation that requires all configured realms to successfully process the submitted AuthenticationToken during the log-in attempt.

If one or more realms do not support the submitted token, or one or more are unable to acquire AuthenticationInfo for the token, this implementation will immediately fail the log-in attempt for the associated subject (user).

Since:
0.2
Author:
Les Hazlewood

Constructor Summary
AllSuccessfulModularAuthenticationStrategy()
           
 
Method Summary
 AuthenticationInfo afterAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo info, AuthenticationInfo aggregate, Throwable t)
          Method invoked by the ModularAuthenticator just after the given realm has been consulted for authentication, allowing post-authentication-attempt logic for that realm only.
 AuthenticationInfo beforeAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo info)
          Method invoked by the ModularAuthenticator just prior to the realm being consulted for account data, allowing pre-authentication-attempt logic for that realm only.
 
Methods inherited from class org.jsecurity.authc.pam.AbstractAuthenticationStrategy
afterAllAttempts, beforeAllAttempts, merge
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AllSuccessfulModularAuthenticationStrategy

public AllSuccessfulModularAuthenticationStrategy()
Method Detail

beforeAttempt

public AuthenticationInfo beforeAttempt(Realm realm,
                                        AuthenticationToken token,
                                        AuthenticationInfo info)
                                 throws AuthenticationException
Description copied from interface: ModularAuthenticationStrategy
Method invoked by the ModularAuthenticator just prior to the realm being consulted for account data, allowing pre-authentication-attempt logic for that realm only.

This method returns an AuthenticationInfo object that will be used for further interaction with realms. Most implementations will merely return the aggregate method argument if they don't have a need to manipulate it.

Specified by:
beforeAttempt in interface ModularAuthenticationStrategy
Overrides:
beforeAttempt in class AbstractAuthenticationStrategy
Parameters:
realm - the realm that will be consulted for AuthenticationInfo for the specified token.
token - the AuthenticationToken submitted for the subject attempting system log-in.
info - the aggregated AuthenticationInfo object being used across the multi-realm authentication attempt
Returns:
the AuthenticationInfo object that will be presented to further realms in the authentication process - returning the aggregate method argument is the normal case if no special action needs to be taken.
Throws:
AuthenticationException - an exception thrown by the Strategy implementation if it wishes the login process for the associated subject (user) to stop immediately.

afterAttempt

public AuthenticationInfo afterAttempt(Realm realm,
                                       AuthenticationToken token,
                                       AuthenticationInfo info,
                                       AuthenticationInfo aggregate,
                                       Throwable t)
                                throws AuthenticationException
Description copied from interface: ModularAuthenticationStrategy
Method invoked by the ModularAuthenticator just after the given realm has been consulted for authentication, allowing post-authentication-attempt logic for that realm only.

This method returns an AuthenticationInfo object that will be used for further interaction with realms. Most implementations will merge the singleRealmInfo into the aggregateInfo and just return the aggregateInfo for continued use throughout the authentication process.

Specified by:
afterAttempt in interface ModularAuthenticationStrategy
Overrides:
afterAttempt in class AbstractAuthenticationStrategy
Parameters:
realm - the realm that was just consulted for AuthenticationInfo for the given token.
token - the AuthenticationToken submitted for the subject attempting system log-in.
info - the info returned from a single realm.
aggregate - the aggregate info representing all realms in a multi-realm environment.
t - the Throwable thrown by the Realm during the attempt, or null if the method returned normally.
Returns:
the AuthenticationInfo object that will be presented to further realms in the authentication process - returning the aggregateAccount method argument is the normal case if no special action needs to be taken.
Throws:
AuthenticationException - an exception thrown by the Strategy implementation if it wishes the login process for the associated subject (user) to stop immediately.

JSecurity

Copyright © 2004-2008 JSecurity.