diff --git a/core/src/main/java/org/springframework/security/providers/ldap/LdapAuthenticationProvider.java b/core/src/main/java/org/springframework/security/providers/ldap/LdapAuthenticationProvider.java index eb922cb133..f41f9148c1 100644 --- a/core/src/main/java/org/springframework/security/providers/ldap/LdapAuthenticationProvider.java +++ b/core/src/main/java/org/springframework/security/providers/ldap/LdapAuthenticationProvider.java @@ -39,8 +39,8 @@ import org.apache.commons.logging.LogFactory; /** - * An {@link org.springframework.security.providers.AuthenticationProvider} implementation that provides integration - * with an LDAP server. + * An {@link org.springframework.security.providers.AuthenticationProvider} implementation that authenticates + * against an LDAP server. *
* There are many ways in which an LDAP directory can be configured so this class delegates most of * its responsibilites to two separate strategy interfaces, {@link LdapAuthenticator} @@ -73,27 +73,30 @@ import org.apache.commons.logging.LogFactory; * * A simple configuration might be as follows: *
- * <bean id="initialDirContextFactory" class="org.springframework.security.providers.ldap.DefaultInitialDirContextFactory"> - * <constructor-arg value="ldap://monkeymachine:389/dc=springframework,dc=org"/> - * <property name="managerDn"><value>cn=manager,dc=springframework,dc=org</value></property> - * <property name="managerPassword"><value>password</value></property> - * </bean> + * <bean id="contextSource" + * class="org.springframework.security.ldap.DefaultSpringSecurityContextSource"> + * <constructor-arg value="ldap://monkeymachine:389/dc=springframework,dc=org"/> + * <property name="userDn" value="cn=manager,dc=springframework,dc=org"/> + * <property name="password" value="password"/> + * </bean> * - * <bean id="ldapAuthProvider" class="org.springframework.security.providers.ldap.LdapAuthenticationProvider"> - * <constructor-arg> - * <bean class="org.springframework.security.providers.ldap.authenticator.BindAuthenticator"> - * <constructor-arg><ref local="initialDirContextFactory"/></constructor-arg> - * <property name="userDnPatterns"><list><value>uid={0},ou=people</value></list></property> - * </bean> - * </constructor-arg> - * <constructor-arg> - * <bean class="org.springframework.security.providers.ldap.populator.DefaultLdapAuthoritiesPopulator"> - * <constructor-arg><ref local="initialDirContextFactory"/></constructor-arg> - * <constructor-arg><value>ou=groups</value></constructor-arg> - * <property name="groupRoleAttribute"><value>ou</value></property> - * </bean> - * </constructor-arg> - * </bean>+ * <bean id="ldapAuthProvider" + * class="org.springframework.security.providers.ldap.LdapAuthenticationProvider"> + * <constructor-arg> + * <bean class="org.springframework.security.providers.ldap.authenticator.BindAuthenticator"> + * <constructor-arg ref="contextSource"/> + * <property name="userDnPatterns"><list><value>uid={0},ou=people</value></list></property> + * </bean> + * </constructor-arg> + * <constructor-arg> + * <bean class="org.springframework.security.ldap.populator.DefaultLdapAuthoritiesPopulator"> + * <constructor-arg ref="contextSource"/> + * <constructor-arg value="ou=groups"/> + * <property name="groupRoleAttribute" value="ou"/> + * </bean> + * </constructor-arg> + * </bean> + * * *
* This would set up the provider to access an LDAP server with URL