Skip to content

Commit c4b1747

Browse files
committed
Improve LDAP snippet formatting
Issue: gh-6486
1 parent 8e6bcc1 commit c4b1747

File tree

1 file changed

+28
-30
lines changed
  • docs/manual/src/docs/asciidoc/_includes/servlet/additional-topics

1 file changed

+28
-30
lines changed

docs/manual/src/docs/asciidoc/_includes/servlet/additional-topics/ldap.adoc

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ If instead you wished to configure an LDAP search filter to locate the user, you
8686
[source,xml]
8787
----
8888
<ldap-authentication-provider user-search-filter="(uid={0})"
89-
user-search-base="ou=people"/>
89+
user-search-base="ou=people"/>
9090
----
9191

9292
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
205205
----
206206
<bean id="contextSource"
207207
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"/>
211211
</bean>
212212
213213
<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>
231230
</bean>
232231
----
233232

@@ -242,10 +241,10 @@ To configure a user search object, which uses the filter `(uid=<user-login-name>
242241
----
243242
244243
<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" />
249248
</bean>
250249
----
251250

@@ -265,10 +264,10 @@ The creation of the `UserDetails` object is controlled by the provider's `UserDe
265264
----
266265
public interface UserDetailsContextMapper {
267266
268-
UserDetails mapUserFromContext(DirContextOperations ctx, String username,
269-
Collection<GrantedAuthority> authorities);
267+
UserDetails mapUserFromContext(DirContextOperations ctx, String username,
268+
Collection<GrantedAuthority> authorities);
270269
271-
void mapUserToContext(UserDetails user, DirContextAdapter ctx);
270+
void mapUserToContext(UserDetails user, DirContextAdapter ctx);
272271
}
273272
----
274273

@@ -298,11 +297,10 @@ An example configuration would then look like this:
298297
----
299298
300299
<bean id="adAuthenticationProvider"
301-
class="org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider">
300+
class="org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider">
302301
<constructor-arg value="mydomain.com" />
303302
<constructor-arg value="ldap://adserver.mydomain.com/" />
304303
</bean>
305-
}
306304
----
307305

308306
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

Comments
 (0)