@@ -86,7 +86,7 @@ If instead you wished to configure an LDAP search filter to locate the user, you
86
86
[source,xml]
87
87
----
88
88
<ldap-authentication-provider user-search-filter="(uid={0})"
89
- user-search-base="ou=people"/>
89
+ user-search-base="ou=people"/>
90
90
----
91
91
92
92
If used with the server definition above, this would perform a search under the DN `ou=people,dc=springframework,dc=org` using the value of the `user-search-filter` attribute as a filter.
@@ -205,29 +205,28 @@ A typical configuration, using some of the beans we've discussed here, might loo
205
205
----
206
206
<bean id="contextSource"
207
207
class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
208
- <constructor-arg value="ldap://monkeymachine:389/dc=springframework,dc=org"/>
209
- <property name="userDn" value="cn=manager,dc=springframework,dc=org"/>
210
- <property name="password" value="password"/>
208
+ <constructor-arg value="ldap://monkeymachine:389/dc=springframework,dc=org"/>
209
+ <property name="userDn" value="cn=manager,dc=springframework,dc=org"/>
210
+ <property name="password" value="password"/>
211
211
</bean>
212
212
213
213
<bean id="ldapAuthProvider"
214
- class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
215
- <constructor-arg>
216
- <bean class="org.springframework.security.ldap.authentication.BindAuthenticator">
217
- <constructor-arg ref="contextSource"/>
218
- <property name="userDnPatterns">
219
- <list><value>uid={0},ou=people</value></list>
220
- </property>
221
- </bean>
222
- </constructor-arg>
223
- <constructor-arg>
224
- <bean
225
- class="org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator">
226
- <constructor-arg ref="contextSource"/>
227
- <constructor-arg value="ou=groups"/>
228
- <property name="groupRoleAttribute" value="ou"/>
229
- </bean>
230
- </constructor-arg>
214
+ class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
215
+ <constructor-arg>
216
+ <bean class="org.springframework.security.ldap.authentication.BindAuthenticator">
217
+ <constructor-arg ref="contextSource"/>
218
+ <property name="userDnPatterns">
219
+ <list><value>uid={0},ou=people</value></list>
220
+ </property>
221
+ </bean>
222
+ </constructor-arg>
223
+ <constructor-arg>
224
+ <bean class="org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator">
225
+ <constructor-arg ref="contextSource"/>
226
+ <constructor-arg value="ou=groups"/>
227
+ <property name="groupRoleAttribute" value="ou"/>
228
+ </bean>
229
+ </constructor-arg>
231
230
</bean>
232
231
----
233
232
@@ -242,10 +241,10 @@ To configure a user search object, which uses the filter `(uid=<user-login-name>
242
241
----
243
242
244
243
<bean id="userSearch"
245
- class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
246
- <constructor-arg index="0" value=""/>
247
- <constructor-arg index="1" value="(uid={0})"/>
248
- <constructor-arg index="2" ref="contextSource" />
244
+ class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
245
+ <constructor-arg index="0" value=""/>
246
+ <constructor-arg index="1" value="(uid={0})"/>
247
+ <constructor-arg index="2" ref="contextSource" />
249
248
</bean>
250
249
----
251
250
@@ -265,10 +264,10 @@ The creation of the `UserDetails` object is controlled by the provider's `UserDe
265
264
----
266
265
public interface UserDetailsContextMapper {
267
266
268
- UserDetails mapUserFromContext(DirContextOperations ctx, String username,
269
- Collection<GrantedAuthority> authorities);
267
+ UserDetails mapUserFromContext(DirContextOperations ctx, String username,
268
+ Collection<GrantedAuthority> authorities);
270
269
271
- void mapUserToContext(UserDetails user, DirContextAdapter ctx);
270
+ void mapUserToContext(UserDetails user, DirContextAdapter ctx);
272
271
}
273
272
----
274
273
@@ -298,11 +297,10 @@ An example configuration would then look like this:
298
297
----
299
298
300
299
<bean id="adAuthenticationProvider"
301
- class="org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider">
300
+ class="org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider">
302
301
<constructor-arg value="mydomain.com" />
303
302
<constructor-arg value="ldap://adserver.mydomain.com/" />
304
303
</bean>
305
- }
306
304
----
307
305
308
306
Note that there is no need to specify a separate `ContextSource` in order to define the server location - the bean is completely self-contained.
0 commit comments