edu.vt.middleware.ldap.auth
Class AbstractAuthenticator<T extends AuthenticatorConfig>

java.lang.Object
  extended by edu.vt.middleware.ldap.auth.AbstractAuthenticator<T>
Type Parameters:
T - type of AuthenticatorConfig
Direct Known Subclasses:
Authenticator

public abstract class AbstractAuthenticator<T extends AuthenticatorConfig>
extends Object

AbstractAuthenticator provides basic functionality for authenticating against an LDAP.

Version:
$Revision: 1743 $ $Date: 2010-11-19 12:00:18 -0500 (Fri, 19 Nov 2010) $
Author:
Middleware Services

Field Summary
protected  T config
          Authenticator configuration environment.
protected  org.apache.commons.logging.Log logger
          Log for this class.
 
Constructor Summary
AbstractAuthenticator()
           
 
Method Summary
protected  boolean authenticateAndAuthorize(String dn, Object credential, AuthenticationResultHandler[] authResultHandler, AuthorizationHandler[] authzHandler)
          This will authenticate by binding to the LDAP with the supplied dn and credential.
protected  Attributes authenticateAndAuthorize(String dn, Object credential, boolean searchAttrs, String[] retAttrs, AuthenticationResultHandler[] authResultHandler, AuthorizationHandler[] authzHandler)
          This will authenticate by binding to the LDAP with the supplied dn and credential.
 void close()
          This will close the connection on the underlying DN resolver.
 void setAuthenticatorConfig(T authConfig)
          This will set the config parameters of this Authenticator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Log for this class.


config

protected T extends AuthenticatorConfig config
Authenticator configuration environment.

Constructor Detail

AbstractAuthenticator

public AbstractAuthenticator()
Method Detail

setAuthenticatorConfig

public void setAuthenticatorConfig(T authConfig)
This will set the config parameters of this Authenticator.

Parameters:
authConfig - AuthenticatorConfig

authenticateAndAuthorize

protected boolean authenticateAndAuthorize(String dn,
                                           Object credential,
                                           AuthenticationResultHandler[] authResultHandler,
                                           AuthorizationHandler[] authzHandler)
                                    throws NamingException
This will authenticate by binding to the LDAP with the supplied dn and credential. See authenticateAndAuthorize( String, Object, boolean, String[], AuthenticationResultHandler[], AuthorizationHandler[]).

Parameters:
dn - String for bind
credential - Object for bind
authResultHandler - AuthenticationResultHandler[] to post process authentication results
authzHandler - AuthorizationHandler[] to process authorization after authentication
Returns:
boolean - whether the bind succeeded
Throws:
NamingException - if the authentication fails for any other reason than invalid credentials

authenticateAndAuthorize

protected Attributes authenticateAndAuthorize(String dn,
                                              Object credential,
                                              boolean searchAttrs,
                                              String[] retAttrs,
                                              AuthenticationResultHandler[] authResultHandler,
                                              AuthorizationHandler[] authzHandler)
                                       throws NamingException
This will authenticate by binding to the LDAP with the supplied dn and credential. Authentication will never succeed if LdapConfig.getAuthtype() is set to 'none'. If retAttrs is null and searchAttrs is true then all user attributes will be returned. If retAttrs is an empty array and searchAttrs is true then no attributes will be returned. This method throws AuthenticationException if authentication fails and AuthorizationException if authorization fails.

Parameters:
dn - String for bind
credential - Object for bind
searchAttrs - boolean whether to perform attribute search
retAttrs - String[] user attributes to return
authResultHandler - AuthenticationResultHandler[] to post process authentication results
authzHandler - AuthorizationHandler[] to process authorization after authentication
Returns:
Attribute - belonging to the supplied user, returns null if searchAttrs is false
Throws:
NamingException - if any of the ldap operations fail
AuthenticationException - if authentication fails
AuthorizationException - if authorization fails

close

public void close()
This will close the connection on the underlying DN resolver.



Copyright © 2003-2010 Virginia Tech. All Rights Reserved.