|
@@ -27,7 +27,8 @@ import org.springframework.util.Assert;
|
|
|
import javax.naming.directory.Attributes;
|
|
|
|
|
|
/**
|
|
|
- * The class responsible for LDAP authentication.
|
|
|
+ * An {@link org.acegisecurity.providers.AuthenticationProvider} implementation that
|
|
|
+ * provides integration with an LDAP server.
|
|
|
*
|
|
|
* <p>
|
|
|
* There are many ways in which an LDAP directory can be configured so this class
|
|
@@ -63,6 +64,42 @@ import javax.naming.directory.Attributes;
|
|
|
* for example from a database.
|
|
|
* </p>
|
|
|
*
|
|
|
+ * <h3>Configuration</h3>
|
|
|
+ * A simple configuration might be as follows:
|
|
|
+ * <pre>
|
|
|
+ * <bean id="initialDirContextFactory" class="org.acegisecurity.providers.ldap.DefaultInitialDirContextFactory">
|
|
|
+ * <constructor-arg value="ldap://monkeymachine:389/dc=acegisecurity,dc=org"/>
|
|
|
+ * <property name="managerDn"><value>cn=manager,dc=acegisecurity,dc=org</value></property>
|
|
|
+ * <property name="managerPassword"><value>password</value></property>
|
|
|
+ * </bean>
|
|
|
+ *
|
|
|
+ * <bean id="ldapAuthProvider" class="org.acegisecurity.providers.ldap.LdapAuthenticationProvider">
|
|
|
+ * <constructor-arg>
|
|
|
+ * <bean class="org.acegisecurity.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.acegisecurity.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>
|
|
|
+ * <p>
|
|
|
+ * This would set up the provider to access an LDAP server with URL
|
|
|
+ * <tt>ldap://monkeymachine:389/dc=acegisecurity,dc=org</tt>. Authentication will be performed by
|
|
|
+ * attempting to bind with the DN <tt>uid=<user-login-name>,ou=people,dc=acegisecurity,dc=org</tt>.
|
|
|
+ * After successful authentication, roles will be assigned to the user by searching under the DN
|
|
|
+ * <tt>ou=groups,dc=acegisecurity,dc=org</tt> with the default filter <tt>(member=<user's-DN>)</tt>.
|
|
|
+ * The role name will be taken from the "ou" attribute of each match.
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @see org.acegisecurity.providers.ldap.authenticator.BindAuthenticator
|
|
|
+ * @see org.acegisecurity.providers.ldap.populator.DefaultLdapAuthoritiesPopulator
|
|
|
*
|
|
|
* @author Luke Taylor
|
|
|
* @version $Id$
|