org.springframework.security.ldap
Class DefaultSpringSecurityContextSource

java.lang.Object
  extended by org.springframework.ldap.core.support.AbstractContextSource
      extended by org.springframework.ldap.core.support.LdapContextSource
          extended by org.springframework.security.ldap.DefaultSpringSecurityContextSource
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, org.springframework.context.MessageSourceAware, org.springframework.ldap.core.ContextSource, org.springframework.ldap.core.support.BaseLdapPathContextSource, org.springframework.ldap.core.support.BaseLdapPathSource, SpringSecurityContextSource

public class DefaultSpringSecurityContextSource
extends org.springframework.ldap.core.support.LdapContextSource
implements SpringSecurityContextSource, org.springframework.context.MessageSourceAware

SpringSecurityContextSource implementation which uses Spring LDAP's LdapContextSource as a base class. Intended as a replacement for DefaultInitialDirContextFactory from versions of the framework prior to 2.0.

Since:
2.0
Version:
$Id$
Author:
Luke Taylor

Field Summary
protected  org.springframework.context.support.MessageSourceAccessor messages
           
 
Fields inherited from class org.springframework.ldap.core.support.AbstractContextSource
password, SUN_LDAP_POOLING_FLAG, userDn
 
Constructor Summary
DefaultSpringSecurityContextSource(java.lang.String providerUrl)
          Create and initialize an instance which will connect to the supplied LDAP URL.
 
Method Summary
 javax.naming.directory.DirContext getReadWriteContext(java.lang.String userDn, java.lang.Object credentials)
          Obtains a context using the supplied distinguished name and credentials.
 void setMessageSource(org.springframework.context.MessageSource messageSource)
           
 
Methods inherited from class org.springframework.ldap.core.support.LdapContextSource
getDirContextInstance
 
Methods inherited from class org.springframework.ldap.core.support.AbstractContextSource
afterPropertiesSet, assembleProviderUrlString, createContext, getAnonymousEnv, getAuthenticatedEnv, getAuthenticationSource, getBase, getBaseLdapPath, getBaseLdapPathAsString, getContext, getContextFactory, getDirObjectFactory, getReadOnlyContext, getReadWriteContext, getUrls, isAnonymousReadOnly, isPooled, setAnonymousReadOnly, setAuthenticationSource, setAuthenticationStrategy, setBase, setBaseEnvironmentProperties, setCacheEnvironmentProperties, setContextFactory, setDirObjectFactory, setPassword, setPooled, setReferral, setupAuthenticatedEnvironment, setUrl, setUrls, setUserDn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.ldap.core.ContextSource
getContext, getReadOnlyContext, getReadWriteContext
 
Methods inherited from interface org.springframework.ldap.core.support.BaseLdapPathSource
getBaseLdapPath, getBaseLdapPathAsString
 

Field Detail

messages

protected org.springframework.context.support.MessageSourceAccessor messages
Constructor Detail

DefaultSpringSecurityContextSource

public DefaultSpringSecurityContextSource(java.lang.String providerUrl)
Create and initialize an instance which will connect to the supplied LDAP URL.

Parameters:
providerUrl - an LDAP URL of the form ldap://localhost:389/base_dn
Method Detail

getReadWriteContext

public javax.naming.directory.DirContext getReadWriteContext(java.lang.String userDn,
                                                             java.lang.Object credentials)
Description copied from interface: SpringSecurityContextSource
Obtains a context using the supplied distinguished name and credentials.

Specified by:
getReadWriteContext in interface SpringSecurityContextSource
Parameters:
userDn - the distinguished name of the user to authenticate as
credentials - the user's password
Returns:
a context authenticated as the supplied user

setMessageSource

public void setMessageSource(org.springframework.context.MessageSource messageSource)
Specified by:
setMessageSource in interface org.springframework.context.MessageSourceAware