Updated example configuration in javadoc for LdapAuthenticationProvider.

This commit is contained in:
Luke Taylor 2008-03-21 17:12:22 +00:00
parent 037ccd5eaa
commit b73736ffaf
1 changed files with 25 additions and 22 deletions

View File

@ -39,8 +39,8 @@ import org.apache.commons.logging.LogFactory;
/** /**
* An {@link org.springframework.security.providers.AuthenticationProvider} implementation that provides integration * An {@link org.springframework.security.providers.AuthenticationProvider} implementation that authenticates
* with an LDAP server. * against an LDAP server.
* <p> * <p>
* There are many ways in which an LDAP directory can be configured so this class delegates most of * 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} * 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: * A simple configuration might be as follows:
* <pre> * <pre>
* &lt;bean id="initialDirContextFactory" class="org.springframework.security.providers.ldap.DefaultInitialDirContextFactory"> * &lt;bean id=&quot;contextSource&quot;
* &lt;constructor-arg value="ldap://monkeymachine:389/dc=springframework,dc=org"/> * class=&quot;org.springframework.security.ldap.DefaultSpringSecurityContextSource&quot;&gt;
* &lt;property name="managerDn">&lt;value>cn=manager,dc=springframework,dc=org&lt;/value>&lt;/property> * &lt;constructor-arg value=&quot;ldap://monkeymachine:389/dc=springframework,dc=org&quot;/&gt;
* &lt;property name="managerPassword">&lt;value>password&lt;/value>&lt;/property> * &lt;property name=&quot;userDn&quot; value=&quot;cn=manager,dc=springframework,dc=org&quot;/&gt;
* &lt;/bean> * &lt;property name=&quot;password&quot; value=&quot;password&quot;/&gt;
* &lt;/bean&gt;
* *
* &lt;bean id="ldapAuthProvider" class="org.springframework.security.providers.ldap.LdapAuthenticationProvider"> * &lt;bean id=&quot;ldapAuthProvider&quot;
* &lt;constructor-arg> * class=&quot;org.springframework.security.providers.ldap.LdapAuthenticationProvider&quot;&gt;
* &lt;bean class="org.springframework.security.providers.ldap.authenticator.BindAuthenticator"> * &lt;constructor-arg&gt;
* &lt;constructor-arg>&lt;ref local="initialDirContextFactory"/>&lt;/constructor-arg> * &lt;bean class=&quot;org.springframework.security.providers.ldap.authenticator.BindAuthenticator&quot;&gt;
* &lt;property name="userDnPatterns">&lt;list>&lt;value>uid={0},ou=people&lt;/value>&lt;/list>&lt;/property> * &lt;constructor-arg ref=&quot;contextSource&quot;/&gt;
* &lt;/bean> * &lt;property name=&quot;userDnPatterns&quot;&gt;&lt;list&gt;&lt;value&gt;uid={0},ou=people&lt;/value&gt;&lt;/list&gt;&lt;/property&gt;
* &lt;/constructor-arg> * &lt;/bean&gt;
* &lt;constructor-arg> * &lt;/constructor-arg&gt;
* &lt;bean class="org.springframework.security.providers.ldap.populator.DefaultLdapAuthoritiesPopulator"> * &lt;constructor-arg&gt;
* &lt;constructor-arg>&lt;ref local="initialDirContextFactory"/>&lt;/constructor-arg> * &lt;bean class=&quot;org.springframework.security.ldap.populator.DefaultLdapAuthoritiesPopulator&quot;&gt;
* &lt;constructor-arg>&lt;value>ou=groups&lt;/value>&lt;/constructor-arg> * &lt;constructor-arg ref=&quot;contextSource&quot;/&gt;
* &lt;property name="groupRoleAttribute">&lt;value>ou&lt;/value>&lt;/property> * &lt;constructor-arg value=&quot;ou=groups&quot;/&gt;
* &lt;/bean> * &lt;property name=&quot;groupRoleAttribute&quot; value=&quot;ou&quot;/&gt;
* &lt;/constructor-arg> * &lt;/bean&gt;
* &lt;/bean></pre> * &lt;/constructor-arg&gt;
* &lt;/bean&gt;
* </pre>
* *
* <p> * <p>
* This would set up the provider to access an LDAP server with URL * This would set up the provider to access an LDAP server with URL