org.jasig.cas.authentication.handler.support
Class AbstractUsernamePasswordAuthenticationHandler

java.lang.Object
  extended by org.jasig.cas.authentication.handler.support.AbstractPreAndPostProcessingAuthenticationHandler
      extended by org.jasig.cas.authentication.handler.support.AbstractUsernamePasswordAuthenticationHandler
All Implemented Interfaces:
AuthenticationHandler, NamedAuthenticationHandler
Direct Known Subclasses:
JaasAuthenticationHandler, SimpleTestUsernamePasswordAuthenticationHandler

public abstract class AbstractUsernamePasswordAuthenticationHandler
extends AbstractPreAndPostProcessingAuthenticationHandler

Abstract class to override supports so that we don't need to duplicate the check for UsernamePasswordCredentials.

Since:
3.0

This is a published and supported CAS Server 3 API.

Version:
$Revision: 47522 $ $Date: 2009-12-14 23:33:36 -0500 (Mon, 14 Dec 2009) $
Author:
Scott Battaglia

Field Summary
 
Fields inherited from class org.jasig.cas.authentication.handler.support.AbstractPreAndPostProcessingAuthenticationHandler
log
 
Constructor Summary
AbstractUsernamePasswordAuthenticationHandler()
           
 
Method Summary
protected abstract  boolean authenticateUsernamePasswordInternal(UsernamePasswordCredentials credentials)
          Abstract convenience method that assumes the credentials passed in are a subclass of UsernamePasswordCredentials.
protected  boolean doAuthentication(Credentials credentials)
          Method automatically handles conversion to UsernamePasswordCredentials and delegates to abstract authenticateUsernamePasswordInternal so subclasses do not need to cast.
protected  PasswordEncoder getPasswordEncoder()
          Method to return the PasswordEncoder to be used to encode passwords.
protected  PrincipalNameTransformer getPrincipalNameTransformer()
           
 void setClassToSupport(java.lang.Class<?> classToSupport)
          Method to set the class to support.
 void setPasswordEncoder(PasswordEncoder passwordEncoder)
          Sets the PasswordEncoder to be used with this class.
 void setPrincipalNameTransformer(PrincipalNameTransformer principalNameTransformer)
           
 void setSupportSubClasses(boolean supportSubClasses)
          Method to set whether this handler will support subclasses of the supported class.
 boolean supports(Credentials credentials)
          Method to check if the handler knows how to handle the credentials provided.
 
Methods inherited from class org.jasig.cas.authentication.handler.support.AbstractPreAndPostProcessingAuthenticationHandler
authenticate, getName, postAuthenticate, preAuthenticate, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractUsernamePasswordAuthenticationHandler

public AbstractUsernamePasswordAuthenticationHandler()
Method Detail

doAuthentication

protected final boolean doAuthentication(Credentials credentials)
                                  throws AuthenticationException
Method automatically handles conversion to UsernamePasswordCredentials and delegates to abstract authenticateUsernamePasswordInternal so subclasses do not need to cast.

Specified by:
doAuthentication in class AbstractPreAndPostProcessingAuthenticationHandler
Throws:
AuthenticationException

authenticateUsernamePasswordInternal

protected abstract boolean authenticateUsernamePasswordInternal(UsernamePasswordCredentials credentials)
                                                         throws AuthenticationException
Abstract convenience method that assumes the credentials passed in are a subclass of UsernamePasswordCredentials.

Parameters:
credentials - the credentials representing the Username and Password presented to CAS
Returns:
true if the credentials are authentic, false otherwise.
Throws:
AuthenticationException - if authenticity cannot be determined.

getPasswordEncoder

protected final PasswordEncoder getPasswordEncoder()
Method to return the PasswordEncoder to be used to encode passwords.

Returns:
the PasswordEncoder associated with this class.

getPrincipalNameTransformer

protected final PrincipalNameTransformer getPrincipalNameTransformer()

setClassToSupport

public final void setClassToSupport(java.lang.Class<?> classToSupport)
Method to set the class to support.

Parameters:
classToSupport - the class we want this handler to support explicitly.

setSupportSubClasses

public final void setSupportSubClasses(boolean supportSubClasses)
Method to set whether this handler will support subclasses of the supported class.

Parameters:
supportSubClasses - boolean of whether to support subclasses or not.

setPasswordEncoder

public final void setPasswordEncoder(PasswordEncoder passwordEncoder)
Sets the PasswordEncoder to be used with this class.

Parameters:
passwordEncoder - the PasswordEncoder to use when encoding passwords.

setPrincipalNameTransformer

public final void setPrincipalNameTransformer(PrincipalNameTransformer principalNameTransformer)

supports

public final boolean supports(Credentials credentials)
Description copied from interface: AuthenticationHandler
Method to check if the handler knows how to handle the credentials provided. It may be a simple check of the Credentials class or something more complicated such as scanning the information contained in the Credentials object.

Parameters:
credentials - The credentials to check.
Returns:
true if the credentials are not null and the credentials class is equal to the class defined in classToSupport.


Copyright © 2004-2010 Java Architectures Special Interest Group. All Rights Reserved.