Skip to content

Commit d872763

Browse files
committed
SEC-1785: Remove auto-config from manual.
Changed the namespace doc to use an explicit form-login and logout element and avoid mention of auto-config or its effects. This makes the intro shorter and simpler.
1 parent ebba8ac commit d872763

File tree

2 files changed

+18
-40
lines changed

2 files changed

+18
-40
lines changed

docs/manual/src/docbook/appendix-namespace.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,12 @@
7777
</section>
7878
<section xml:id="nsa-http-auto-config">
7979
<title><literal>auto-config</literal></title>
80-
<para>Automatically registers a login form, BASIC authentication, anonymous authentication, logout
81-
services, remember-me and servlet-api-integration. If set to "true", all of these capabilities are added
80+
<para>Automatically registers a login form, BASIC authentication, logout
81+
services. If set to "true", all of these capabilities are added
8282
(although you can still customize the configuration of each by providing the respective element). If
83-
unspecified, defaults to "false".</para>
83+
unspecified, defaults to "false". Use of this attribute is not recommended. Use explicit
84+
configuration elements instead to avoid confusion.
85+
</para>
8486
</section>
8587
<section xml:id="nsa-http-create-session">
8688
<title><literal>create-session</literal></title>

docs/manual/src/docbook/namespace-config.xml

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,16 @@
133133
<section xml:id="ns-minimal">
134134
<title>A Minimal <literal>&lt;http&gt;</literal> Configuration</title>
135135
<para> All you need to enable web security to begin with is <programlisting language="xml"><![CDATA[
136-
<http auto-config='true'>
136+
<http>
137137
<intercept-url pattern="/**" access="ROLE_USER" />
138+
<form-login />
139+
<logout />
138140
</http>
139141
]]>
140142
</programlisting> Which says that we want all URLs within our application to be secured,
141-
requiring the role <literal>ROLE_USER</literal> to access them. The
143+
requiring the role <literal>ROLE_USER</literal> to access them, we want to log in to
144+
the application using a form with username and password, and that we want a logout URL
145+
registered which will allow us to log out of the application.
142146
<literal>&lt;http></literal> element is the parent for all web-related namespace
143147
functionality. The <literal>&lt;intercept-url></literal> element defines a
144148
<literal>pattern</literal> which is matched against the URLs of incoming requests
@@ -216,33 +220,7 @@
216220
turn.</para>
217221
<para> At this point you should be able to start up your application and you will be
218222
required to log in to proceed. Try it out, or try experimenting with the
219-
<quote>tutorial</quote> sample application that comes with the project. The above
220-
configuration actually adds quite a few services to the application because we have
221-
used the <literal>auto-config</literal> attribute. For example, form-based login
222-
processing is automatically enabled. </para>
223-
<section xml:id="ns-auto-config">
224-
<title>What does <literal>auto-config</literal> Include?</title>
225-
<para> The <literal>auto-config</literal> attribute, as we have used it above, is
226-
just a shorthand syntax for: <programlisting language="xml"><![CDATA[
227-
<http>
228-
<form-login />
229-
<http-basic />
230-
<logout />
231-
</http>
232-
]]></programlisting> These other elements are responsible for setting up form-login, basic
233-
authentication and logout handling services respectively <footnote>
234-
<para>In versions prior to 3.0, this list also included remember-me
235-
functionality. This could cause some confusing errors with some
236-
configurations and was removed in 3.0. In 3.0, the addition of an
237-
<classname>AnonymousAuthenticationFilter</classname> is part of the default
238-
<literal>&lt;http></literal> configuration, so the <literal>&lt;anonymous
239-
/></literal> element is added regardless of whether
240-
<literal>auto-config</literal> is enabled.</para>
241-
</footnote>. They each have attributes which can be used to alter their
242-
behaviour. In anything other than very basic scenarios, it is probably better to
243-
omit the <literal>auto-config</literal> attribute and configure what you require
244-
explicitly in the interest of clarity.</para>
245-
</section>
223+
<quote>tutorial</quote> sample application that comes with the project.</para>
246224
</section>
247225
<section xml:id="ns-form-and-basic">
248226
<title>Form and Basic Login Options</title>
@@ -251,17 +229,16 @@
251229
explicitly set a URL for the login page, Spring Security generates one
252230
automatically, based on the features that are enabled and using standard values for
253231
the URL which processes the submitted login, the default target URL the user will be
254-
sent to after loggin in and so on. However, the namespace offers plenty of support
232+
sent to after logging in and so on. However, the namespace offers plenty of support
255233
to allow you to customize these options. For example, if you want to supply your own
256234
login page, you could use: <programlisting language="xml"><![CDATA[
257-
<http auto-config='true'>
235+
<http>
258236
<intercept-url pattern="/login.jsp*" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
259237
<intercept-url pattern="/**" access="ROLE_USER" />
260238
<form-login login-page='/login.jsp'/>
261239
</http>
262240
]]>
263-
</programlisting> Note that you can still use <literal>auto-config</literal>. The
264-
<literal>form-login</literal> element just overrides the default settings. Also note
241+
</programlisting> Also note
265242
that we've added an extra <literal>intercept-url</literal> element to say that any
266243
requests for the login page should be available to anonymous users <footnote>
267244
<para>See the chapter on <link xlink:href="#anonymous">anonymous
@@ -278,7 +255,7 @@
278255
<http pattern="/css/**" security="none"/>
279256
<http pattern="/login.jsp*" security="none"/>
280257
281-
<http auto-config='true'>
258+
<http>
282259
<intercept-url pattern="/**" access="ROLE_USER" />
283260
<form-login login-page='/login.jsp'/>
284261
</http>
@@ -305,7 +282,7 @@
305282
still want the security filter chain to be applied.</para>
306283
<para>If you want to use basic authentication instead of form login, then change the
307284
configuration to <programlisting language="xml"><![CDATA[
308-
<http auto-config='true'>
285+
<http>
309286
<intercept-url pattern="/**" access="ROLE_USER" />
310287
<http-basic />
311288
</http>
@@ -777,8 +754,7 @@ List&lt;OpenIDAttribute> attributes = token.getAttributes();</programlisting>The
777754
<title>Avoiding filter position conflicts</title>
778755
<para> If you are inserting a custom filter which may occupy the same position as
779756
one of the standard filters created by the namespace then it's important that
780-
you don't include the namespace versions by mistake. Avoid using the
781-
<literal>auto-config</literal> attribute and remove any elements which create
757+
you don't include the namespace versions by mistake. Remove any elements which create
782758
filters whose functionality you want to replace. </para>
783759
<para> Note that you can't replace filters which are created by the use of the
784760
<literal>&lt;http&gt;</literal> element itself -

0 commit comments

Comments
 (0)