springsecurity.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <book version="5.0" xml:id="spring-security-reference-guide" xmlns="http://docbook.org/ns/docbook"
  3. xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
  4. <info><title>Spring Security</title><subtitle>Reference Documentation</subtitle><authorgroup>
  5. <author>
  6. <personname>Ben Alex</personname>
  7. </author>
  8. <author>
  9. <personname>Luke Taylor</personname>
  10. </author>
  11. </authorgroup>
  12. <productname>Spring Security</productname>
  13. <releaseinfo>3.0.0.M2</releaseinfo>
  14. </info>
  15. <toc/>
  16. <preface xml:id="preface">
  17. <title>Preface</title>
  18. <para>Spring Security provides a comprehensive security solution for J2EE-based enterprise
  19. software applications. As you will discover as you venture through this reference guide, we
  20. have tried to provide you a useful and highly configurable security system.</para>
  21. <para>Security is an ever-moving target, and it's important to pursue a comprehensive,
  22. system-wide approach. In security circles we encourage you to adopt "layers of security", so
  23. that each layer tries to be as secure as possible in its own right, with successive layers
  24. providing additional security. The "tighter" the security of each layer, the more robust and
  25. safe your application will be. At the bottom level you'll need to deal with issues such as
  26. transport security and system identification, in order to mitigate man-in-the-middle attacks.
  27. Next you'll generally utilise firewalls, perhaps with VPNs or IP security to ensure only
  28. authorised systems can attempt to connect. In corporate environments you may deploy a DMZ to
  29. separate public-facing servers from backend database and application servers. Your operating
  30. system will also play a critical part, addressing issues such as running processes as
  31. non-privileged users and maximising file system security. An operating system will usually
  32. also be configured with its own firewall. Hopefully somewhere along the way you'll be trying
  33. to prevent denial of service and brute force attacks against the system. An intrusion
  34. detection system will also be especially useful for monitoring and responding to attacks, with
  35. such systems able to take protective action such as blocking offending TCP/IP addresses in
  36. real-time. Moving to the higher layers, your Java Virtual Machine will hopefully be configured
  37. to minimize the permissions granted to different Java types, and then your application will
  38. add its own problem domain-specific security configuration. Spring Security makes this latter
  39. area - application security - much easier. </para>
  40. <para>Of course, you will need to properly address all security layers mentioned above, together
  41. with managerial factors that encompass every layer. A non-exhaustive list of such managerial
  42. factors would include security bulletin monitoring, patching, personnel vetting, audits,
  43. change control, engineering management systems, data backup, disaster recovery, performance
  44. benchmarking, load monitoring, centralised logging, incident response procedures etc.</para>
  45. <para>With Spring Security being focused on helping you with the enterprise application security
  46. layer, you will find that there are as many different requirements as there are business
  47. problem domains. A banking application has different needs from an ecommerce application. An
  48. ecommerce application has different needs from a corporate sales force automation tool. These
  49. custom requirements make application security interesting, challenging and rewarding. </para>
  50. <para>Please read <xref linkend="getting-started"/>, in its entirety to begin with. This will
  51. introduce you to the framework and the namespace-based configuration system with which you can
  52. get up and running quite quickly. To get more of an understanding of an in-depth understaning
  53. of how Spring Security works, and some of the classes you might need to use, you should then
  54. read <xref linkend="overall-architecture"/>. The remaining parts of this guide are structured
  55. in a more traditional reference style, designed to be read on an as-required basis. We'd also
  56. recommend that you read up as much as possible on application security issues in general.
  57. Spring Security is not a panacea which will solve all security issues. It is important that
  58. the application is designed with security in mind from the start. Attempting to retrofit it is
  59. not a good idea. In particular, if you are building a web application, you should be aware of
  60. the many potential vulnerabilities such as cross-site scripting, request-forgery and
  61. session-hijacking which you should be taking into account from the start. The OWASP web site
  62. (http://www.owasp.org/) maintains a top ten list of web application vulnerabilities as well as
  63. a lot of useful reference information. </para>
  64. <para>We hope that you find this reference guide useful, and we welcome your feedback and <link
  65. xlink:href="#jira">suggestions</link>. </para>
  66. <para>Finally, welcome to the Spring Security <link xlink:href="#community">community</link>.
  67. </para>
  68. </preface>
  69. <part xml:id="getting-started">
  70. <title>Getting Started</title>
  71. <partintro>
  72. <para>The later parts of this guide provide an in-depth discussion of the framework
  73. architecture and implementation classes, an understanding of which is important if you need
  74. to do any serious customization. In this part, we'll introduce Spring Security 3.0, give a
  75. brief overview of the project's history and take a slightly gentler look at how to get
  76. started using the framework. In particular, we'll look at namespace configuration which
  77. provides a much simpler way of securing your application compared to the traditional Spring
  78. bean approach where you had to wire up all the implementation classes individually. </para>
  79. <para> We'll also take a look at the sample applications that are available. It's worth trying
  80. to run these and experimenting with them a bit even before you read the later sections - you
  81. can dip back into them as your understanding of the framework increases. </para>
  82. </partintro>
  83. <xi:include href="introduction.xml"/>
  84. <xi:include href="namespace-config.xml"/>
  85. <xi:include href="samples.xml"/>
  86. <xi:include href="community.xml"/>
  87. </part>
  88. <part xml:id="overall-architecture">
  89. <title>Architecture and Implementation</title>
  90. <partintro>
  91. <para>Once you are familiar with setting up and running some namespace-configuration based
  92. applications, you may wish to develop more of an understanding of how the framework actually
  93. works behind the namespace facade. Like most software, Spring Security has certain central
  94. interfaces, classes and conceptual abstractions that are commonly used throughout the
  95. framework. In this part of the reference guide we will look at some of these and see how
  96. they work together to support authentication and access-control within Spring
  97. Security.</para>
  98. </partintro>
  99. <xi:include href="technical-overview.xml"/>
  100. <xi:include href="core-services.xml"/>
  101. </part>
  102. <part xml:id="web-app-security">
  103. <title>Web Application Security</title>
  104. <partintro>
  105. <para> Most Spring Security users will be using the framework in applications which make user
  106. of HTTP and the Servlet API. In this part, we'll take a look at how Spring Security provides
  107. authentication and access-control features for the web layer of an application. We'll look
  108. behind the facade of the namespace and see which classes and interfaces are actually
  109. assembled to provide web-layer security. In some situations it is necessary to use
  110. traditional bean configuration to provide full control over the configuration, so we'll also
  111. see how to configure these classes directly without the namespace.</para>
  112. </partintro>
  113. <xi:include href="security-filter-chain.xml"/>
  114. <xi:include href="core-filters.xml"/>
  115. <xi:include href="basic-and-digest-auth.xml"/>
  116. <xi:include href="remember-me-authentication.xml"/>
  117. <xi:include href="concurrent-sessions.xml"/>
  118. <xi:include href="anon-auth-provider.xml"/>
  119. </part>
  120. <!--
  121. <part xml:id="authentication">
  122. <title>Authentication</title>
  123. <partintro>
  124. <para>We've already introduced Spring Security's authentication architecture in the <link
  125. xlink:href="#technical-overview">Technical Overview</link> chapter. In this part of the
  126. reference guide we will examine individual authentication mechanisms and their corresponding
  127. <classname>AuthenticationProvider</classname>s. We'll also look at how to configure
  128. authentication more generally, including if you have several authentication approaches that
  129. need to be chained together.</para>
  130. <para> With some exceptions, we will be discussing the full details of Spring Security bean
  131. configuration rather than the shorthand <link xlink:href="#ns-config">namespace
  132. syntax</link>. You should review the introduction to using namespace configuration and the
  133. options it provides to see if they will meet your needs. As you come to use the framework
  134. more, and need to customize the internal behaviour, you will probably want to understand
  135. more about how the individual services are implemented, which classes to look at extending
  136. and so on. This part is more targeted at providing this kind of information. We'd recommend
  137. that you supplement the content by browsing the Javadoc and the source itself <footnote>
  138. <para>Links to both Javadoc APIs and browsable source cross-reference are available from
  139. the project web site.</para>
  140. </footnote>. </para>
  141. </partintro>
  142. <xi:include href="dao-auth-provider.xml"/>
  143. </part>
  144. -->
  145. <part xml:id="authorization">
  146. <title>Authorization</title>
  147. <partintro>
  148. <para>The advanced authorization capabilities within Spring Security represent one of the most
  149. compelling reasons for its popularity. Irrespective of how you choose to authenticate -
  150. whether using a Spring Security-provided mechanism and provider, or integrating with a
  151. container or other non-Spring Security authentication authority - you will find the
  152. authorization services can be used within your application in a consistent and simple
  153. way.</para>
  154. <para>In this part we'll explore the different
  155. <classname>AbstractSecurityInterceptor</classname> implementations, which were introduced
  156. in Part I. We then move on to explore how to fine-tune authorization through use of domain
  157. access control lists.</para>
  158. </partintro>
  159. <xi:include href="authorization-common.xml"/>
  160. <xi:include href="secured-objects.xml"/>
  161. </part>
  162. <part xml:id="advanced-topics">
  163. <title>Advanced Topics</title>
  164. <!--
  165. Essentially standalone features which do not have to follow on directly from earlier chapters
  166. -->
  167. <partintro>
  168. <para> In this part we cover some of the more advanced and less-commonly used features of the framework.</para>
  169. </partintro>
  170. <xi:include href="domain-acls.xml"/>
  171. <xi:include href="preauth.xml"/>
  172. <xi:include href="ldap-auth-provider.xml"/>
  173. <xi:include href="jaas-auth-provider.xml"/>
  174. <xi:include href="cas-auth-provider.xml"/>
  175. <xi:include href="x509-auth-provider.xml"/>
  176. <xi:include href="runas-auth-provider.xml"/>
  177. </part>
  178. <xi:include href="appendix-db-schema.xml"/>
  179. <xi:include href="appendix-namespace.xml"/>
  180. </book>