springsecurity.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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.1.RELEASE</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 how Spring Security
  53. works, and some of the classes you might need to use, you should then read <xref
  54. linkend="overall-architecture"/>. The remaining parts of this guide are structured in a more
  55. traditional reference style, designed to be read on an as-required basis. We'd also recommend
  56. that you read up as much as possible on application security issues in general. Spring
  57. Security is not a panacea which will solve all security issues. It is important that the
  58. application is designed with security in mind from the start. Attempting to retrofit it is not
  59. a good idea. In particular, if you are building a web application, you should be aware of the
  60. 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, which you need to understand if you want to do any
  74. serious customization. In this part, we'll introduce Spring Security 3.0, give a brief
  75. overview of the project's history and take a slightly gentler look at how to get started
  76. using the framework. In particular, we'll look at namespace configuration which provides a
  77. much simpler way of securing your application compared to the traditional Spring bean
  78. approach where you have 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. Please also check
  82. out the <link xlink:href="http://static.springsource.org/spring-security/site/index.html"
  83. >project website</link> as it has useful information on building the project, plus links
  84. to articles, videos and tutorials. </para>
  85. </partintro>
  86. <xi:include href="introduction.xml"/>
  87. <xi:include href="namespace-config.xml"/>
  88. <xi:include href="samples.xml"/>
  89. <xi:include href="community.xml"/>
  90. </part>
  91. <part xml:id="overall-architecture">
  92. <title>Architecture and Implementation</title>
  93. <partintro>
  94. <para>Once you are familiar with setting up and running some namespace-configuration based
  95. applications, you may wish to develop more of an understanding of how the framework actually
  96. works behind the namespace facade. Like most software, Spring Security has certain central
  97. interfaces, classes and conceptual abstractions that are commonly used throughout the
  98. framework. In this part of the reference guide we will look at some of these and see how
  99. they work together to support authentication and access-control within Spring
  100. Security.</para>
  101. </partintro>
  102. <xi:include href="technical-overview.xml"/>
  103. <xi:include href="core-services.xml"/>
  104. </part>
  105. <part xml:id="web-app-security">
  106. <title>Web Application Security</title>
  107. <partintro>
  108. <para> Most Spring Security users will be using the framework in applications which make user
  109. of HTTP and the Servlet API. In this part, we'll take a look at how Spring Security provides
  110. authentication and access-control features for the web layer of an application. We'll look
  111. behind the facade of the namespace and see which classes and interfaces are actually
  112. assembled to provide web-layer security. In some situations it is necessary to use
  113. traditional bean configuration to provide full control over the configuration, so we'll also
  114. see how to configure these classes directly without the namespace.</para>
  115. </partintro>
  116. <xi:include href="security-filter-chain.xml"/>
  117. <xi:include href="core-filters.xml"/>
  118. <xi:include href="basic-and-digest-auth.xml"/>
  119. <xi:include href="remember-me-authentication.xml"/>
  120. <xi:include href="session-mgmt.xml"/>
  121. <xi:include href="anon-auth-provider.xml"/>
  122. </part>
  123. <!--
  124. <part xml:id="authentication">
  125. <title>Authentication</title>
  126. <partintro>
  127. <para>We've already introduced Spring Security's authentication architecture in the <link
  128. xlink:href="#technical-overview">Technical Overview</link> chapter. In this part of the
  129. reference guide we will examine individual authentication mechanisms and their corresponding
  130. <classname>AuthenticationProvider</classname>s. We'll also look at how to configure
  131. authentication more generally, including if you have several authentication approaches that
  132. need to be chained together.</para>
  133. <para> With some exceptions, we will be discussing the full details of Spring Security bean
  134. configuration rather than the shorthand <link xlink:href="#ns-config">namespace
  135. syntax</link>. You should review the introduction to using namespace configuration and the
  136. options it provides to see if they will meet your needs. As you come to use the framework
  137. more, and need to customize the internal behaviour, you will probably want to understand
  138. more about how the individual services are implemented, which classes to look at extending
  139. and so on. This part is more targeted at providing this kind of information. We'd recommend
  140. that you supplement the content by browsing the Javadoc and the source itself <footnote>
  141. <para>Links to both Javadoc APIs and browsable source cross-reference are available from
  142. the project web site.</para>
  143. </footnote>. </para>
  144. </partintro>
  145. <xi:include href="dao-auth-provider.xml"/>
  146. </part>
  147. -->
  148. <part xml:id="authorization">
  149. <title>Authorization</title>
  150. <partintro>
  151. <para>The advanced authorization capabilities within Spring Security represent one of the most
  152. compelling reasons for its popularity. Irrespective of how you choose to authenticate -
  153. whether using a Spring Security-provided mechanism and provider, or integrating with a
  154. container or other non-Spring Security authentication authority - you will find the
  155. authorization services can be used within your application in a consistent and simple
  156. way.</para>
  157. <para>In this part we'll explore the different
  158. <classname>AbstractSecurityInterceptor</classname> implementations, which were introduced
  159. in Part I. We then move on to explore how to fine-tune authorization through use of domain
  160. access control lists.</para>
  161. </partintro>
  162. <xi:include href="authorization-common.xml"/>
  163. <xi:include href="secured-objects.xml"/>
  164. <xi:include href="el-access.xml"/>
  165. </part>
  166. <part xml:id="advanced-topics">
  167. <title>Additional Topics</title>
  168. <!--
  169. Essentially standalone features which do not have to follow on directly from earlier chapters
  170. -->
  171. <partintro>
  172. <para> In this part we cover features which require a knowledge of previous chapters as well
  173. as some of the more advanced and less-commonly used features of the framework.</para>
  174. </partintro>
  175. <xi:include href="domain-acls.xml"/>
  176. <xi:include href="preauth.xml"/>
  177. <xi:include href="ldap-auth-provider.xml"/>
  178. <xi:include href="taglibs.xml"/>
  179. <xi:include href="jaas-auth-provider.xml"/>
  180. <xi:include href="cas-auth-provider.xml"/>
  181. <xi:include href="x509-auth-provider.xml"/>
  182. <xi:include href="runas-auth-provider.xml"/>
  183. </part>
  184. <xi:include href="appendix-db-schema.xml"/>
  185. <xi:include href="appendix-namespace.xml"/>
  186. </book>