org.springframework.security.ldap.authentication
Class AbstractLdapAuthenticator

java.lang.Object
  extended by org.springframework.security.ldap.authentication.AbstractLdapAuthenticator
All Implemented Interfaces:
InitializingBean, MessageSourceAware, LdapAuthenticator
Direct Known Subclasses:
BindAuthenticator, PasswordComparisonAuthenticator

public abstract class AbstractLdapAuthenticator
extends Object
implements LdapAuthenticator, InitializingBean, MessageSourceAware

Base class for the authenticator implementations.

Version:
$Id: AbstractLdapAuthenticator.java 3640 2009-05-04 14:24:54Z ltaylor $
Author:
Luke Taylor

Field Summary
protected  MessageSourceAccessor messages
           
 
Constructor Summary
AbstractLdapAuthenticator(org.springframework.ldap.core.ContextSource contextSource)
          Create an initialized instance with the ContextSource provided.
 
Method Summary
 void afterPropertiesSet()
           
protected  org.springframework.ldap.core.ContextSource getContextSource()
           
 String[] getUserAttributes()
           
protected  List<String> getUserDns(String username)
          Builds list of possible DNs for the user, worked out from the userDnPatterns property.
protected  LdapUserSearch getUserSearch()
           
 void setMessageSource(MessageSource messageSource)
           
 void setUserAttributes(String[] userAttributes)
          Sets the user attributes which will be retrieved from the directory.
 void setUserDnPatterns(String[] dnPattern)
          Sets the pattern which will be used to supply a DN for the user.
 void setUserSearch(LdapUserSearch userSearch)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.security.ldap.authentication.LdapAuthenticator
authenticate
 

Field Detail

messages

protected MessageSourceAccessor messages
Constructor Detail

AbstractLdapAuthenticator

public AbstractLdapAuthenticator(org.springframework.ldap.core.ContextSource contextSource)
Create an initialized instance with the ContextSource provided.

Parameters:
contextSource -
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

getContextSource

protected org.springframework.ldap.core.ContextSource getContextSource()

getUserAttributes

public String[] getUserAttributes()

getUserDns

protected List<String> getUserDns(String username)
Builds list of possible DNs for the user, worked out from the userDnPatterns property.

Parameters:
username - the user's login name
Returns:
the list of possible DN matches, empty if userDnPatterns wasn't set.

getUserSearch

protected LdapUserSearch getUserSearch()

setMessageSource

public void setMessageSource(MessageSource messageSource)
Specified by:
setMessageSource in interface MessageSourceAware

setUserAttributes

public void setUserAttributes(String[] userAttributes)
Sets the user attributes which will be retrieved from the directory.

Parameters:
userAttributes -

setUserDnPatterns

public void setUserDnPatterns(String[] dnPattern)
Sets the pattern which will be used to supply a DN for the user. The pattern should be the name relative to the root DN. The pattern argument {0} will contain the username. An example would be "cn={0},ou=people".

Parameters:
dnPattern - the array of patterns which will be tried when converting a username to a DN.

setUserSearch

public void setUserSearch(LdapUserSearch userSearch)


Copyright © 2004-2009 SpringSource, Inc. All Rights Reserved.