Spring Security Framework

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:
InitializingBean, 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, 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  MessageSourceAccessor messages
           
 
Fields inherited from class org.springframework.ldap.core.support.AbstractContextSource
password, SUN_LDAP_POOLING_FLAG, userDn
 
Constructor Summary
DefaultSpringSecurityContextSource(String providerUrl)
          Create and initialize an instance which will connect to the supplied LDAP URL.
 
Method Summary
 DirContext getReadWriteContext(String userDn, Object credentials)
          Obtains a context using the supplied distinguished name and credentials.
 void setMessageSource(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, getContextFactory, getDirObjectFactory, getReadOnlyContext, getReadWriteContext, getUrls, isAnonymousReadOnly, isPooled, setAnonymousReadOnly, setAuthenticationSource, setBase, setBaseEnvironmentProperties, setCacheEnvironmentProperties, setContextFactory, setDirObjectFactory, setPassword, setPooled, setupAuthenticatedEnvironment, setUrl, setUrls, setUserDn, setUserName
 
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
getReadOnlyContext, getReadWriteContext
 
Methods inherited from interface org.springframework.ldap.core.support.BaseLdapPathSource
getBaseLdapPath, getBaseLdapPathAsString
 

Field Detail

messages

protected MessageSourceAccessor messages
Constructor Detail

DefaultSpringSecurityContextSource

public DefaultSpringSecurityContextSource(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 DirContext getReadWriteContext(String userDn,
                                      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(MessageSource messageSource)
Specified by:
setMessageSource in interface MessageSourceAware

Spring Security Framework

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