mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-12 21:33:30 +00:00
Minor corrections to namespace chapter. Fixed image paths for pdf version
This commit is contained in:
parent
6de01e0079
commit
10e6ed20cf
@ -95,6 +95,9 @@ public boolean supports(Class clazz);</programlisting></para>
|
|||||||
based on voting. Figure 4 illustrates the relevant classes.</para>
|
based on voting. Figure 4 illustrates the relevant classes.</para>
|
||||||
|
|
||||||
<para><mediaobject>
|
<para><mediaobject>
|
||||||
|
<imageobject role="fo">
|
||||||
|
<imagedata align="center" fileref="resources/images/AccessDecisionVoting.gif" format="GIF"/>
|
||||||
|
</imageobject>
|
||||||
<imageobject role="html">
|
<imageobject role="html">
|
||||||
<imagedata align="center" fileref="images/AccessDecisionVoting.gif" format="GIF"/>
|
<imagedata align="center" fileref="images/AccessDecisionVoting.gif" format="GIF"/>
|
||||||
</imageobject>
|
</imageobject>
|
||||||
@ -266,7 +269,10 @@ public boolean supports(Class clazz);</programlisting></para>
|
|||||||
|
|
||||||
<para><mediaobject>
|
<para><mediaobject>
|
||||||
<imageobject>
|
<imageobject>
|
||||||
<imagedata align="center" fileref="images/AfterInvocation.gif" format="GIF"/>
|
<imagedata role="fo" align="center" fileref="resources/images/AfterInvocation.gif" format="GIF"/>
|
||||||
|
</imageobject>
|
||||||
|
<imageobject>
|
||||||
|
<imagedata role="html" align="center" fileref="images/AfterInvocation.gif" format="GIF"/>
|
||||||
</imageobject>
|
</imageobject>
|
||||||
|
|
||||||
<caption>
|
<caption>
|
||||||
|
@ -108,6 +108,9 @@
|
|||||||
access control list (ACL) lookups.</para>
|
access control list (ACL) lookups.</para>
|
||||||
|
|
||||||
<para><mediaobject>
|
<para><mediaobject>
|
||||||
|
<imageobject>
|
||||||
|
<imagedata role="fo" align="center" fileref="resources/images/ACLSecurity.gif" format="GIF"/>
|
||||||
|
</imageobject>
|
||||||
<imageobject role="html">
|
<imageobject role="html">
|
||||||
<imagedata align="center" fileref="images/ACLSecurity.gif" format="GIF"/>
|
<imagedata align="center" fileref="images/ACLSecurity.gif" format="GIF"/>
|
||||||
</imageobject>
|
</imageobject>
|
||||||
@ -166,6 +169,9 @@ public AclEntry[] getAcls(java.lang.Object domainInstance, Authentication authen
|
|||||||
implementation, which is shown in Figure 7.</para>
|
implementation, which is shown in Figure 7.</para>
|
||||||
|
|
||||||
<para><mediaobject>
|
<para><mediaobject>
|
||||||
|
<imageobject role="fo">
|
||||||
|
<imagedata align="center" fileref="resources/images/BasicAclProvider.gif" format="GIF"/>
|
||||||
|
</imageobject>
|
||||||
<imageobject role="html">
|
<imageobject role="html">
|
||||||
<imagedata align="center" fileref="images/BasicAclProvider.gif" format="GIF"/>
|
<imagedata align="center" fileref="images/BasicAclProvider.gif" format="GIF"/>
|
||||||
</imageobject>
|
</imageobject>
|
||||||
@ -457,6 +463,9 @@ END;
|
|||||||
for more information.</para>
|
for more information.</para>
|
||||||
|
|
||||||
<mediaobject>
|
<mediaobject>
|
||||||
|
<imageobject role="fo">
|
||||||
|
<imagedata align="center" fileref="resources/images/Permissions.gif" format="GIF"/>
|
||||||
|
</imageobject>
|
||||||
<imageobject role="html">
|
<imageobject role="html">
|
||||||
<imagedata align="center" fileref="images/Permissions.gif" format="GIF"/>
|
<imagedata align="center" fileref="images/Permissions.gif" format="GIF"/>
|
||||||
</imageobject>
|
</imageobject>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<security:ldap-server />
|
<security:ldap-server />
|
||||||
]]></programlisting>
|
]]></programlisting>
|
||||||
This is much simpler than wiring up the equivalent Apache Directory Server beans. The most
|
This is much simpler than wiring up the equivalent Apache Directory Server beans. The most
|
||||||
common alterative configuration requirements are supported by attributes on the
|
common alternative configuration requirements are supported by attributes on the
|
||||||
<literal>ldap-server</literal>
|
<literal>ldap-server</literal>
|
||||||
element and the user is isolated from worrying about which beans they need to be set on and
|
element and the user is isolated from worrying about which beans they need to be set on and
|
||||||
what the bean property names are.
|
what the bean property names are.
|
||||||
@ -126,7 +126,7 @@
|
|||||||
<section>
|
<section>
|
||||||
<info><title><literal>web.xml</literal> Configuration</title></info>
|
<info><title><literal>web.xml</literal> Configuration</title></info>
|
||||||
<para>
|
<para>
|
||||||
The first thing you need to do is add the following fiter declaration to your
|
The first thing you need to do is add the following filter declaration to your
|
||||||
<literal>web.xml</literal>
|
<literal>web.xml</literal>
|
||||||
file:
|
file:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
@ -196,7 +196,7 @@
|
|||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
At this point you should be able to start up your application and you will be required to
|
At this point you should be able to start up your application and you will be required to
|
||||||
log in to proceed. Try it out, or try experimenting with the "tutorial" sample applicaition
|
log in to proceed. Try it out, or try experimenting with the "tutorial" sample application
|
||||||
that comes with the project. The above configuration actually adds quite a few services to
|
that comes with the project. The above configuration actually adds quite a few services to
|
||||||
the application because we have used the
|
the application because we have used the
|
||||||
<literal>auto-config</literal>
|
<literal>auto-config</literal>
|
||||||
@ -222,19 +222,23 @@
|
|||||||
</http>
|
</http>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
These other elements are responsible for setting up form-login, see
|
These other elements are responsible for setting up form-login,
|
||||||
<link xlink:href="#anonymous">anonymous authentication</link>, basic authentication, logout handling and remember-me services
|
<link xlink:href="#anonymous">anonymous authentication</link>, basic authentication, logout handling and remember-me services
|
||||||
respectively. They each have attributes which can be used to alter their behaviour. For example, if you
|
respectively. They each have attributes which can be used to alter their behaviour. For example, if you
|
||||||
want to supply your own login page, you could use:
|
want to supply your own login page, you could use:
|
||||||
<programlisting><![CDATA[
|
<programlisting><![CDATA[
|
||||||
<http auto-config='true'>
|
<http auto-config='true'>
|
||||||
|
<intercept-url pattern="/login.jsp*" filters="none"/>
|
||||||
<intercept-url pattern="/**" access="ROLE_USER" />
|
<intercept-url pattern="/**" access="ROLE_USER" />
|
||||||
<form-login login-page='/login.jsp'/>
|
<form-login login-page='/login.jsp'/>
|
||||||
</http>
|
</http>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
Note that you can still use <literal>auto-config</literal>. The <literal>form-login</literal> element just overrides the
|
Note that you can still use <literal>auto-config</literal>. The <literal>form-login</literal> element just overrides the
|
||||||
default settings. If you want to use basic authentication instead of form login, then change the configuration to
|
default settings. Also note that we've added an extra <literal>intercept-url</literal> element to say that any requests
|
||||||
|
for the login page should be excluded from processing by the security filters. Otherwise the request would be matched by
|
||||||
|
the pattern <literal>/**</literal> and it wouldn't be possible to access the login page itself!
|
||||||
|
If you want to use basic authentication instead of form login, then change the configuration to
|
||||||
<programlisting><![CDATA[
|
<programlisting><![CDATA[
|
||||||
<http auto-config='true'>
|
<http auto-config='true'>
|
||||||
<intercept-url pattern="/**" access="ROLE_USER" />
|
<intercept-url pattern="/**" access="ROLE_USER" />
|
||||||
@ -247,34 +251,35 @@
|
|||||||
through a login form embedded in another web page.
|
through a login form embedded in another web page.
|
||||||
</para>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
</section>
|
||||||
<title>Configuring other Authentication Providers</title>
|
<section>
|
||||||
<para>
|
<title>Configuring other Authentication Providers</title>
|
||||||
In practice you will need a more scalable source of user information than a few names added to the context file.
|
<para>
|
||||||
Most likely you will want to store your user information in something like a database or an LDAP server. LDAP namespace
|
In practice you will need a more scalable source of user information than a few names added to the context file.
|
||||||
configuration is dealt with in the <link xlink:href="#ldap">LDAP chapter</link>, so we won't cover it here. If you have a
|
Most likely you will want to store your user information in something like a database or an LDAP server. LDAP namespace
|
||||||
custom implementation of Spring Security's <classname>UserDetailsService</classname>, called "myUserDetailsService" in your
|
configuration is dealt with in the <link xlink:href="#ldap">LDAP chapter</link>, so we won't cover it here. If you have a
|
||||||
application context, then you can authenticate against this using
|
custom implementation of Spring Security's <classname>UserDetailsService</classname>, called "myUserDetailsService" in your
|
||||||
<programlisting><![CDATA[
|
application context, then you can authenticate against this using
|
||||||
|
<programlisting><![CDATA[
|
||||||
<authentication-provider user-service-ref='myUserDetailsService'/>
|
<authentication-provider user-service-ref='myUserDetailsService'/>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
If you want to use a database, then you can use
|
If you want to use a database, then you can use
|
||||||
<programlisting><![CDATA[
|
<programlisting><![CDATA[
|
||||||
<authentication-provider>
|
<authentication-provider>
|
||||||
<jdbc-user-service data-source-ref="securityDataSource"/>
|
<jdbc-user-service data-source-ref="securityDataSource"/>
|
||||||
</authentication-provider>
|
</authentication-provider>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
Where "securityDataSource" is the name of a <classname>DataSource</classname> bean in the application context,
|
Where "securityDataSource" is the name of a <classname>DataSource</classname> bean in the application context,
|
||||||
pointing at a database containing the standard Spring Security user data tables. Alternatively, you could configure
|
pointing at a database containing the standard Spring Security user data tables. Alternatively, you could configure
|
||||||
a Spring Security <classname>JdbcDaoImpl</classname> bean and point at that using the <literal>user-service-ref</literal>
|
a Spring Security <classname>JdbcDaoImpl</classname> bean and point at that using the <literal>user-service-ref</literal>
|
||||||
attribute.
|
attribute.
|
||||||
</para>
|
</para>
|
||||||
<section><title>Adding a Password Encoder</title>
|
<section><title>Adding a Password Encoder</title>
|
||||||
<para>
|
<para>
|
||||||
Often your password data will be encoded using a hashing algorithm. This is supported by the <literal>>password-encoder<</literal>
|
Often your password data will be encoded using a hashing algorithm. This is supported by the <literal><password-encoder></literal>
|
||||||
element. With SHA-encoded passwords, the original authentication provider configuration would look like this:
|
element. With SHA encoded passwords, the original authentication provider configuration would look like this:
|
||||||
<programlisting><![CDATA[
|
<programlisting><![CDATA[
|
||||||
<authentication-provider>
|
<authentication-provider>
|
||||||
<password-encoder hash="sha"/>
|
<password-encoder hash="sha"/>
|
||||||
@ -286,22 +291,20 @@
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
When using hashed passwords, it's also a good idea to use a salt value to protect against dictionary attacks and Spring Security supports this too.
|
When using hashed passwords, it's also a good idea to use a salt value to protect against dictionary attacks and Spring Security supports this too.
|
||||||
Ideally you would want to use a randomly generated salt value for each user, but you can use any property of the <classname>UserDetails</classname>
|
Ideally you would want to use a randomly generated salt value for each user, but you can use any property of the <classname>UserDetails</classname>
|
||||||
object which is loaded by your <classname>UserDetailsService</classname>. For example, to use the <literal>username</literal> property, you would use
|
object which is loaded by your <classname>UserDetailsService</classname>. For example, to use the <literal>username</literal> property, you would use
|
||||||
<programlisting><![CDATA[
|
<programlisting><![CDATA[
|
||||||
<password-encoder hash="sha">
|
<password-encoder hash="sha">
|
||||||
<salt-source user-property="username"/>
|
<salt-source user-property="username"/>
|
||||||
</password-encoder>
|
</password-encoder>
|
||||||
]]></programlisting>
|
]]></programlisting>
|
||||||
You can use a custom password ecoder bean by using the <literal>ref</literal> attribute of <literal>password-encoder</literal>. This should
|
You can use a custom password encoder bean by using the <literal>ref</literal> attribute of <literal>password-encoder</literal>. This should
|
||||||
contain the name of a bean in the application context which is an instance of Spring Security's <interfacename>PasswordEncoder</interfacename>
|
contain the name of a bean in the application context which is an instance of Spring Security's <interfacename>PasswordEncoder</interfacename>
|
||||||
interface.
|
interface.
|
||||||
</para>
|
</para>
|
||||||
</section>
|
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
</chapter>
|
</chapter>
|
@ -84,16 +84,18 @@
|
|||||||
<part xml:id="getting-started">
|
<part xml:id="getting-started">
|
||||||
<title>Getting Started</title>
|
<title>Getting Started</title>
|
||||||
<partintro>
|
<partintro>
|
||||||
<para>The remaining parts of this guide provide an in-depth discussion of the
|
<para>The later parts of this guide provide an in-depth discussion of the
|
||||||
framework architecture and implementation classes, an understanding of which is important
|
framework architecture and implementation classes, an understanding of which is important
|
||||||
if you need to do any serious customization. In this part, we take a slightly
|
if you need to do any serious customization. In this part, we take a slightly
|
||||||
gentler look at how to get started using some of the features of Spring Security 2.0.
|
gentler look at how to get started using some of the features of Spring Security 2.0.
|
||||||
The use of namespace configuration provides a much simpler path to securing
|
In particular, the use of namespace configuration provides a much simpler path to securing
|
||||||
your application with little or no knowledge of the classes involved, unlike the traditional
|
your application with little or no knowledge of the classes involved, unlike the traditional
|
||||||
Spring bean approach which required you to configure large numbers of beans.
|
Spring bean approach which required you to configure large numbers of beans.
|
||||||
</para>
|
</para>
|
||||||
</partintro>
|
</partintro>
|
||||||
|
|
||||||
|
<xi:include href="introduction.xml" />
|
||||||
|
|
||||||
<xi:include href="namespace-config.xml" />
|
<xi:include href="namespace-config.xml" />
|
||||||
|
|
||||||
</part>
|
</part>
|
||||||
@ -109,8 +111,6 @@
|
|||||||
are necessary to successfully planning and executing a Spring Security
|
are necessary to successfully planning and executing a Spring Security
|
||||||
integration.</para>
|
integration.</para>
|
||||||
</partintro>
|
</partintro>
|
||||||
|
|
||||||
<xi:include href="introduction.xml" />
|
|
||||||
|
|
||||||
<xi:include href="technical-overview.xml" />
|
<xi:include href="technical-overview.xml" />
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="technical-overview"><info><title>Technical Overview</title></info>
|
<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="technical-overview">
|
||||||
|
<info><title>Technical Overview</title></info>
|
||||||
|
|
||||||
|
<section xml:id="runtime-environment">
|
||||||
<section xml:id="runtime-environment"><info><title>Runtime Environment</title></info>
|
<info><title>Runtime Environment</title></info>
|
||||||
|
|
||||||
|
|
||||||
<para>Spring Security is written to execute within a standard Java 1.4
|
<para>Spring Security is written to execute within a standard Java 1.4
|
||||||
Runtime Environment. It also supports Java 5.0, although the Java
|
Runtime Environment. It also supports Java 5.0, although the Java
|
||||||
@ -477,11 +477,9 @@ String username = obj.toString();
|
|||||||
<imageobject role="html">
|
<imageobject role="html">
|
||||||
<imagedata align="center" fileref="images/SecurityInterception.gif" format="GIF"/>
|
<imagedata align="center" fileref="images/SecurityInterception.gif" format="GIF"/>
|
||||||
</imageobject>
|
</imageobject>
|
||||||
|
|
||||||
<imageobject role="fo">
|
<imageobject role="fo">
|
||||||
<imagedata align="center" fileref="images/SecurityInterception.gif" format="GIF"/>
|
<imagedata align="center" fileref="resources/images/SecurityInterception.gif" format="GIF"/>
|
||||||
</imageobject>
|
</imageobject>
|
||||||
|
|
||||||
<caption>
|
<caption>
|
||||||
<para>Figure 1: The key "secure object" model</para>
|
<para>Figure 1: The key "secure object" model</para>
|
||||||
</caption>
|
</caption>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user