Skip to content

Commit 2471e32

Browse files
committed
Fix xsd tests
1 parent 2fb056b commit 2471e32

File tree

6 files changed

+1029
-983
lines changed

6 files changed

+1029
-983
lines changed
Lines changed: 100 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,42 @@
11
[[nsa-authentication]]
22
= Authentication Services
33
Before Spring Security 3.0, an `AuthenticationManager` was automatically registered internally.
4-
Now you must register one explicitly by using the `<authentication-manager>` element.
5-
Doing so creates an instance of Spring Security's `ProviderManager` class, which needs to be configured with a list of one or more `AuthenticationProvider` instances.
6-
You can create these instances either by using syntax elements provided by the namespace or by using standard bean definitions, marked for addition to the list by using the `authentication-provider` element.
4+
Now you must register one explicitly using the `<authentication-manager>` element.
5+
This creates an instance of Spring Security's `ProviderManager` class, which needs to be configured with a list of one or more `AuthenticationProvider` instances.
6+
These can either be created using syntax elements provided by the namespace, or they can be standard bean definitions, marked for addition to the list using the `authentication-provider` element.
77

88

99
[[nsa-authentication-manager]]
1010
== <authentication-manager>
11-
Every Spring Security application that uses the namespace must include the `<authentication-manager>` element somewhere.
12-
It is responsible for registering the `AuthenticationManager`, which provides authentication services to the application.
13-
All elements that create `AuthenticationProvider` instances should be children of this element.
11+
Every Spring Security application which uses the namespace must have include this element somewhere.
12+
It is responsible for registering the `AuthenticationManager` which provides authentication services to the application.
13+
All elements which create `AuthenticationProvider` instances should be children of this element.
14+
1415

1516
[[nsa-authentication-manager-attributes]]
1617
=== <authentication-manager> Attributes
1718

18-
The `<authentication-manager>` element has the following attributes:
1919

2020
[[nsa-authentication-manager-alias]]
21-
`alias`::
22-
This attribute lets you define an alias name for the internal instance to use in your own configuration.
21+
* **alias**
22+
This attribute allows you to define an alias name for the internal instance for use in your own configuration.
2323

2424

2525
[[nsa-authentication-manager-erase-credentials]]
26-
`erase-credentials`::
27-
If set to `true`, the `AuthenticationManager` tries to clear any credentials data in the returned `Authentication` object, once the user has been authenticated.
28-
Literally, it maps to the `eraseCredentialsAfterAuthentication` property of the xref:servlet/authentication/architecture.adoc#servlet-authentication-providermanager[`ProviderManager`].
26+
* **erase-credentials**
27+
If set to true, the AuthenticationManager will attempt to clear any credentials data in the returned Authentication object, once the user has been authenticated.
28+
Literally it maps to the `eraseCredentialsAfterAuthentication` property of the xref:servlet/authentication/architecture.adoc#servlet-authentication-providermanager[`ProviderManager`].
2929

3030

3131
[[nsa-authentication-manager-id]]
32-
`id`::
33-
This attribute lets you define an ID for the internal instance to use in your own configuration.
34-
It is the same as the `alias` element but provides a more consistent experience with elements that use the `id` attribute.
32+
* **id**
33+
This attribute allows you to define an id for the internal instance for use in your own configuration.
34+
It is the same as the alias element, but provides a more consistent experience with elements that use the id attribute.
3535

3636

3737
[[nsa-authentication-manager-children]]
3838
=== Child Elements of <authentication-manager>
3939

40-
The `<authentication-manager>` element has the following child elements:
4140

4241
* <<nsa-authentication-provider,authentication-provider>>
4342
* xref:servlet/appendix/namespace/ldap.adoc#nsa-ldap-authentication-provider[ldap-authentication-provider]
@@ -46,98 +45,99 @@ The `<authentication-manager>` element has the following child elements:
4645

4746
[[nsa-authentication-provider]]
4847
== <authentication-provider>
49-
Unless used with a `ref` attribute, the `<authentication-provider>` element is shorthand for configuring a `DaoAuthenticationProvider`.
50-
A `DaoAuthenticationProvider` loads user information from a `UserDetailsService` and compares the username and password combination with the values supplied at login.
51-
You can define the `UserDetailsService` instance either by using an available namespace element (`jdbc-user-service`) or by using the `user-service-ref` attribute to point to a bean defined elsewhere in the application context.
48+
Unless used with a `ref` attribute, this element is shorthand for configuring a `DaoAuthenticationProvider`.
49+
`DaoAuthenticationProvider` loads user information from a `UserDetailsService` and compares the username/password combination with the values supplied at login.
50+
The `UserDetailsService` instance can be defined either by using an available namespace element (`jdbc-user-service` or by using the `user-service-ref` attribute to point to a bean defined elsewhere in the application context).
5251

5352

5453

5554
[[nsa-authentication-provider-parents]]
5655
=== Parent Elements of <authentication-provider>
5756

5857

59-
The parent element of the `<authentication-provider>` element is the <<nsa-authentication-manager,authentication-manager>> element.
58+
* <<nsa-authentication-manager,authentication-manager>>
6059

6160

6261

6362
[[nsa-authentication-provider-attributes]]
6463
=== <authentication-provider> Attributes
6564

66-
The `<authentication-provider>` element has the following attributes:
6765

6866
[[nsa-authentication-provider-ref]]
69-
ref::
67+
* **ref**
7068
Defines a reference to a Spring bean that implements `AuthenticationProvider`.
71-
+
72-
If you have written your own `AuthenticationProvider` implementation (or want to configure one of Spring Security's implementations as a traditional bean for some reason), you can use the following syntax to add it to the internal list of `ProviderManager`:
73-
+
74-
====
69+
70+
If you have written your own `AuthenticationProvider` implementation (or want to configure one of Spring Security's own implementations as a traditional bean for some reason, then you can use the following syntax to add it to the internal list of `ProviderManager`:
71+
7572
[source,xml]
7673
----
74+
7775
<security:authentication-manager>
7876
<security:authentication-provider ref="myAuthenticationProvider" />
7977
</security:authentication-manager>
8078
<bean id="myAuthenticationProvider" class="com.something.MyAuthenticationProvider"/>
79+
8180
----
82-
====
8381

8482

8583

8684

8785
[[nsa-authentication-provider-user-service-ref]]
88-
`user-service-ref`::
89-
A reference to a bean that implements `UserDetailsService`, which may be created by using the standard bean element or the custom user-service element.
86+
* **user-service-ref**
87+
A reference to a bean that implements UserDetailsService that may be created using the standard bean element or the custom user-service element.
9088

9189

9290
[[nsa-authentication-provider-children]]
9391
=== Child Elements of <authentication-provider>
9492

95-
The `<authentication-provider>` element has the following child elements:
9693

9794
* <<nsa-jdbc-user-service,jdbc-user-service>>
9895
* xref:servlet/appendix/namespace/ldap.adoc#nsa-ldap-user-service[ldap-user-service]
9996
* <<nsa-password-encoder,password-encoder>>
10097
* <<nsa-user-service,user-service>>
10198

10299

100+
103101
[[nsa-jdbc-user-service]]
104102
== <jdbc-user-service>
105-
The `<jdbc-user-service>` element causes the creation of a JDBC-based `UserDetailsService`.
103+
Causes creation of a JDBC-based UserDetailsService.
106104

107105

108106
[[nsa-jdbc-user-service-attributes]]
109107
=== <jdbc-user-service> Attributes
110108

111-
The `<jdbc-user-service>` element has the following attributes:
112109

113110
[[nsa-jdbc-user-service-authorities-by-username-query]]
114-
`authorities-by-username-query`::
111+
* **authorities-by-username-query**
115112
An SQL statement to query for a user's granted authorities given a username.
116-
+
117-
The default is as follows:
118-
====
113+
114+
The default is
115+
119116
[source]
120117
----
121118
select username, authority from authorities where username = ?
122119
----
123-
====
120+
121+
122+
124123

125124
[[nsa-jdbc-user-service-cache-ref]]
126-
`cache-ref`::
127-
Defines a reference to a cache for use with a `UserDetailsService`.
125+
* **cache-ref**
126+
Defines a reference to a cache for use with a UserDetailsService.
128127

129128

130129
[[nsa-jdbc-user-service-data-source-ref]]
131-
`data-source-ref`::
132-
The bean ID of the DataSource that provides the required tables.
130+
* **data-source-ref**
131+
The bean ID of the DataSource which provides the required tables.
133132

134133

135134
[[nsa-jdbc-user-service-group-authorities-by-username-query]]
136-
`group-authorities-by-username-query`::
137-
An SQL statement to query user's group authorities, given a username.
138-
The default is as follows:
135+
* **group-authorities-by-username-query**
136+
An SQL statement to query user's group authorities given a username.
137+
The default is
138+
139139
+
140-
====
140+
141141
[source]
142142
----
143143
select
@@ -147,43 +147,45 @@ groups g, group_members gm, group_authorities ga
147147
where
148148
gm.username = ? and g.id = ga.group_id and g.id = gm.group_id
149149
----
150-
====
150+
151+
151152

152153

153154
[[nsa-jdbc-user-service-id]]
154-
`id`::
155-
A bean identifier, which is used for referring to the bean elsewhere in the context.
155+
* **id**
156+
A bean identifier, used for referring to the bean elsewhere in the context.
156157

157158

158159
[[nsa-jdbc-user-service-role-prefix]]
159-
`role-prefix`::
160-
A non-empty string prefix that is added to role strings loaded from persistent storage.
161-
Default: `ROLE_`
162-
Use a value of `none` for no prefix in cases where the default should be non-empty.
160+
* **role-prefix**
161+
A non-empty string prefix that will be added to role strings loaded from persistent storage (default is "ROLE_").
162+
Use the value "none" for no prefix in cases where the default is non-empty.
163163

164164

165165
[[nsa-jdbc-user-service-users-by-username-query]]
166-
`users-by-username-query`::
167-
An SQL statement to query a username, password, and enabled status, given a username.
168-
The default is as follows:
166+
* **users-by-username-query**
167+
An SQL statement to query a username, password, and enabled status given a username.
168+
The default is
169+
169170
+
170-
====
171+
171172
[source]
172173
----
173174
select username, password, enabled from users where username = ?
174175
----
175-
====
176+
177+
178+
176179

177180
[[nsa-password-encoder]]
178181
== <password-encoder>
179-
Injects a bean with the appropriate `PasswordEncoder` instance.
180-
Authentication providers can optionally be configured to use a password encoder, as described in the xref:features/authentication/password-storage.adoc#authentication-password-storage[Password Storage].
182+
Authentication providers can optionally be configured to use a password encoder as described in the xref:features/authentication/password-storage.adoc#authentication-password-storage[Password Storage].
183+
This will result in the bean being injected with the appropriate `PasswordEncoder` instance.
181184

182185

183186
[[nsa-password-encoder-parents]]
184187
=== Parent Elements of <password-encoder>
185188

186-
The `<password-encoder>` element has the following parent elements:
187189

188190
* <<nsa-authentication-provider,authentication-provider>>
189191
* xref:servlet/appendix/namespace/authentication-manager.adoc#nsa-password-compare[password-compare]
@@ -193,94 +195,98 @@ The `<password-encoder>` element has the following parent elements:
193195
[[nsa-password-encoder-attributes]]
194196
=== <password-encoder> Attributes
195197

196-
The `<password-encoder>` element has the following attributes:
197198

198199
[[nsa-password-encoder-hash]]
199-
`hash`::
200-
Defines the hashing algorithm for user passwords.
201-
202-
[IMPORTANT]
203-
====
200+
* **hash**
201+
Defines the hashing algorithm used on user passwords.
204202
We recommend strongly against using MD4, as it is a very weak hashing algorithm.
205-
====
206203

207204

208205
[[nsa-password-encoder-ref]]
209-
`ref`::
206+
* **ref**
210207
Defines a reference to a Spring bean that implements `PasswordEncoder`.
211208

212209

213210
[[nsa-user-service]]
214211
== <user-service>
215-
The `<user-service>` element creates an in-memory `UserDetailsService` from a properties file or a list of `<user>` child elements.
216-
Usernames are converted to lower case internally, to allow for case-insensitive lookups, so do not use this element if you need case-sensitivity.
212+
Creates an in-memory UserDetailsService from a properties file or a list of "user" child elements.
213+
Usernames are converted to lower-case internally to allow for case-insensitive lookups, so this should not be used if case-sensitivity is required.
217214

218215

219216
[[nsa-user-service-attributes]]
220217
=== <user-service> Attributes
221218

222-
The `<user-service>` element has the following attributes:
223219

224220
[[nsa-user-service-id]]
225-
`id`::
226-
A bean identifier, used to refer to the bean elsewhere in the context.
221+
* **id**
222+
A bean identifier, used for referring to the bean elsewhere in the context.
227223

228224

229225
[[nsa-user-service-properties]]
230-
`properties`::
231-
The location of a properties file, in which each line is in the format of
226+
* **properties**
227+
The location of a Properties file where each line is in the format of
228+
232229
+
233-
====
230+
234231
[source]
235232
----
236233
username=password,grantedAuthority[,grantedAuthority][,enabled|disabled]
237234
----
238-
====
235+
236+
237+
239238

240239
[[nsa-user-service-children]]
241240
=== Child Elements of <user-service>
242241

243-
The `<user-service>` element has a single child element: <<nsa-user,user>>.
244-
Multiple `<user>` elements can be present.
242+
243+
* <<nsa-user,user>>
244+
245+
245246

246247
[[nsa-user]]
247248
== <user>
248-
The `<user>` represents a user in the application.
249+
Represents a user in the application.
249250

250251

251252
[[nsa-user-parents]]
252253
=== Parent Elements of <user>
253254

254-
The parent element of the `<user>` element is the <<nsa-user-service,user-service>> element.
255+
256+
* <<nsa-user-service,user-service>>
257+
258+
255259

256260
[[nsa-user-attributes]]
257261
=== <user> Attributes
258262

259263

260264
[[nsa-user-authorities]]
261-
`authorities`::
262-
One of more authorities to be granted to the user.
263-
Separate authorities with a comma (but no space) -- for example, `ROLE_USER,ROLE_ADMINISTRATOR`.
265+
* **authorities**
266+
One of more authorities granted to the user.
267+
Separate authorities with a comma (but no space).
268+
For example, "ROLE_USER,ROLE_ADMINISTRATOR"
264269

265270

266271
[[nsa-user-disabled]]
267-
`disabled`::
268-
Set to `true` to mark an account as disabled and unusable.
272+
* **disabled**
273+
Can be set to "true" to mark an account as disabled and unusable.
269274

270275

271276
[[nsa-user-locked]]
272-
`locked`::
273-
Set to `true` to mark an account as locked and unusable.
277+
* **locked**
278+
Can be set to "true" to mark an account as locked and unusable.
274279

275280

276281
[[nsa-user-name]]
277-
`name`::
282+
* **name**
278283
The username assigned to the user.
279284

280285

281286
[[nsa-user-password]]
282-
`password`::
283-
This value may be hashed if the corresponding authentication provider supports hashing (remember to set the `hash` attribute of the `user-service` element).
284-
You can omit this attribute when the data is not used for authentication but only for accessing authorities.
285-
If omitted, the namespace generates a random value, preventing its accidental use for authentication.
286-
This attribute cannot be empty.
287+
* **password**
288+
The password assigned to the user.
289+
This may be hashed if the corresponding authentication provider supports hashing (remember to set the "hash" attribute of the "user-service" element).
290+
This attribute be omitted in the case where the data will not be used for authentication, but only for accessing authorities.
291+
If omitted, the namespace will generate a random value, preventing its accidental use for authentication.
292+
Cannot be empty.

0 commit comments

Comments
 (0)