|
|
|
|
@ -39,8 +39,8 @@ import org.apache.commons.logging.LogFactory;
@@ -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. |
|
|
|
|
* <p> |
|
|
|
|
* 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;
@@ -73,27 +73,30 @@ import org.apache.commons.logging.LogFactory;
|
|
|
|
|
* |
|
|
|
|
* A simple configuration might be as follows: |
|
|
|
|
* <pre> |
|
|
|
|
* <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></pre> |
|
|
|
|
* <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> |
|
|
|
|
* </pre> |
|
|
|
|
* |
|
|
|
|
* <p> |
|
|
|
|
* This would set up the provider to access an LDAP server with URL |
|
|
|
|
|