introduction.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <chapter version="5.0" xml:id="introduction" xmlns="http://docbook.org/ns/docbook"
  3. xmlns:xlink="http://www.w3.org/1999/xlink">
  4. <title>Introduction</title>
  5. <sect1 xml:id="what-is-acegi-security">
  6. <title>What is Spring Security?</title>
  7. <para>Spring Security provides comprehensive security services for J2EE-based enterprise
  8. software applications. There is a particular emphasis on supporting projects built using
  9. The Spring Framework, which is the leading J2EE solution for enterprise software
  10. development. If you're not using Spring for developing enterprise applications, we
  11. warmly encourage you to take a closer look at it. Some familiarity with Spring - and in
  12. particular dependency injection principles - will help you get up to speed with Spring
  13. Security more easily.</para>
  14. <para>People use Spring Security for many reasons, but most are drawn to the project after
  15. finding the security features of J2EE's Servlet Specification or EJB Specification lack
  16. the depth required for typical enterprise application scenarios. Whilst mentioning these
  17. standards, it's important to recognise that they are not portable at a WAR or EAR level.
  18. Therefore, if you switch server environments, it is typically a lot of work to
  19. reconfigure your application's security in the new target environment. Using Spring
  20. Security overcomes these problems, and also brings you dozens of other useful,
  21. customisable security features.</para>
  22. <para>As you probably know two major areas of application security are
  23. <quote>authentication</quote> and <quote>authorization</quote> (or
  24. <quote>access-control</quote>). These are the the two main areas that Spring
  25. Security targets. <quote>Authentication</quote> is the process of establishing a
  26. principal is who they claim to be (a <quote>principal</quote> generally means a user,
  27. device or some other system which can perform an action in your application).
  28. <quote>Authorization</quote> refers to the process of deciding whether a principal
  29. is allowed to perform an action within your application. To arrive at the point where an
  30. authorization decision is needed, the identity of the principal has already been
  31. established by the authentication process. These concepts are common, and not at all
  32. specific to Spring Security. </para>
  33. <para>At an authentication level, Spring Security supports a wide range of authentication
  34. models. Most of these authentication models are either provided by third parties, or are
  35. developed by relevant standards bodies such as the Internet Engineering Task Force. In
  36. addition, Spring Security provides its own set of authentication features. Specifically,
  37. Spring Security currently supports authentication integration with all of these
  38. technologies:</para>
  39. <itemizedlist spacing="compact">
  40. <listitem>
  41. <para>HTTP BASIC authentication headers (an IEFT RFC-based standard)</para>
  42. </listitem>
  43. <listitem>
  44. <para>HTTP Digest authentication headers (an IEFT RFC-based standard)</para>
  45. </listitem>
  46. <listitem>
  47. <para>HTTP X.509 client certificate exchange (an IEFT RFC-based standard)</para>
  48. </listitem>
  49. <listitem>
  50. <para>LDAP (a very common approach to cross-platform authentication needs,
  51. especially in large environments)</para>
  52. </listitem>
  53. <listitem>
  54. <para>Form-based authentication (for simple user interface needs)</para>
  55. </listitem>
  56. <listitem>
  57. <para>OpenID authentication</para>
  58. </listitem>
  59. <listitem>
  60. <para>Authentication based on pre-established request headers (such as Computer
  61. Associates Siteminder)</para>
  62. </listitem>
  63. <listitem>
  64. <para>JA-SIG Central Authentication Service (otherwise known as CAS, which is a
  65. popular open source single sign on system)</para>
  66. </listitem>
  67. <listitem>
  68. <para>Transparent authentication context propagation for Remote Method Invocation
  69. (RMI) and HttpInvoker (a Spring remoting protocol)</para>
  70. </listitem>
  71. <listitem>
  72. <para>Automatic "remember-me" authentication (so you can tick a box to avoid
  73. re-authentication for a predetermined period of time)</para>
  74. </listitem>
  75. <listitem>
  76. <para>Anonymous authentication (allowing every call to automatically assume a
  77. particular security identity)</para>
  78. </listitem>
  79. <listitem>
  80. <para>Run-as authentication (which is useful if one call should proceed with a
  81. different security identity)</para>
  82. </listitem>
  83. <listitem>
  84. <para>Java Authentication and Authorization Service (JAAS)</para>
  85. </listitem>
  86. <listitem>
  87. <para>JEE container autentication (so you can still use Container Managed
  88. Authentication if desired)</para>
  89. </listitem>
  90. <listitem>
  91. <para>Kerberos</para>
  92. </listitem>
  93. <listitem>
  94. <para>Java Open Source Single Sign On (JOSSO) *</para>
  95. </listitem>
  96. <listitem>
  97. <para>OpenNMS Network Management Platform *</para>
  98. </listitem>
  99. <listitem>
  100. <para>AppFuse *</para>
  101. </listitem>
  102. <listitem>
  103. <para>AndroMDA *</para>
  104. </listitem>
  105. <listitem>
  106. <para>Mule ESB *</para>
  107. </listitem>
  108. <listitem>
  109. <para>Direct Web Request (DWR) *</para>
  110. </listitem>
  111. <listitem>
  112. <para>Grails *</para>
  113. </listitem>
  114. <listitem>
  115. <para>Tapestry *</para>
  116. </listitem>
  117. <listitem>
  118. <para>JTrac *</para>
  119. </listitem>
  120. <listitem>
  121. <para>Jasypt *</para>
  122. </listitem>
  123. <listitem>
  124. <para>Roller *</para>
  125. </listitem>
  126. <listitem>
  127. <para>Elastic Path *</para>
  128. </listitem>
  129. <listitem>
  130. <para>Atlassian Crowd *</para>
  131. </listitem>
  132. <listitem>
  133. <para>Your own authentication systems (see below)</para>
  134. </listitem>
  135. </itemizedlist>
  136. <para>(* Denotes provided by a third party; check our <link
  137. xlink:href="http://acegisecurity.org/powering.html">integration page</link> for
  138. links to the latest details)</para>
  139. <para>Many independent software vendors (ISVs) adopt Spring Security because of this
  140. significant choice of flexible authentication models. Doing so allows them to quickly
  141. integrate their solutions with whatever their end clients need, without undertaking a
  142. lot of engineering or requiring the client to change their environment. If none of the
  143. above authentication mechanisms suit your needs, Spring Security is an open platform and
  144. it is quite simple to write your own authentication mechanism. Many corporate users of
  145. Spring Security need to integrate with "legacy" systems that don't follow any particular
  146. security standards, and Spring Security is happy to "play nicely" with such
  147. systems.</para>
  148. <para>Sometimes the mere process of authentication isn't enough. Sometimes you need to also
  149. differentiate security based on the way a principal is interacting with your
  150. application. For example, you might want to ensure requests only arrive over HTTPS, in
  151. order to protect passwords from eavesdropping or end users from man-in-the-middle
  152. attacks. This is especially helpful to protect password recovery processes from brute
  153. force attacks, or simply to make it harder for people to duplicate your application's
  154. key content. To help you achieve these goals, Spring Security fully supports automatic
  155. "channel security", together with JCaptcha integration for human user detection.</para>
  156. <para>Irrespective of how authentication was undertaken, Spring Security provides a deep set
  157. of authorization capabilities. There are three main areas of interest in respect of
  158. authorization, these being authorizing web requests, authorizing whether methods can be
  159. invoked, and authorizing access to individual domain object instances. To help you
  160. understand the differences, consider the authorization capabilities found in the Servlet
  161. Specification web pattern security, EJB Container Managed Security and file system
  162. security respectively. Spring Security provides deep capabilities in all of these
  163. important areas, which we'll explore later in this reference guide.</para>
  164. </sect1>
  165. <sect1 xml:id="history">
  166. <title>History</title>
  167. <para>Spring Security began in late 2003 as "The Acegi Security System for Spring". A
  168. question was posed on the Spring Developers' mailing list asking whether there had been
  169. any consideration given to a Spring-based security implementation. At the time the
  170. Spring community was relatively small (especially by today's size!), and indeed Spring
  171. itself had only existed as a SourceForge project from early 2003. The response to the
  172. question was that it was a worthwhile area, although a lack of time currently prevented
  173. its exploration.</para>
  174. <para>With that in mind, a simple security implementation was built and not released. A few
  175. weeks later another member of the Spring community inquired about security, and at the
  176. time this code was offered to them. Several other requests followed, and by January 2004
  177. around twenty people were using the code. These pioneering users were joined by others
  178. who suggested a SourceForge project was in order, which was duly established in March
  179. 2004.</para>
  180. <para>In those early days, the project didn't have any of its own authentication modules.
  181. Container Managed Security was relied upon for the authentication process, with Acegi
  182. Security instead focusing on authorization. This was suitable at first, but as more and
  183. more users requested additional container support, the fundamental limitation of
  184. container-specific authentication realm interfaces was experienced. There was also a
  185. related issue of adding new JARs to the container's classpath, which was a common source
  186. of end user confusion and misconfiguration.</para>
  187. <para>Acegi Security-specific authentication services were subsequently introduced. Around a
  188. year later, Acegi Security became an official Spring Framework subproject. The 1.0.0
  189. final release was published in May 2006 - after more than two and a half years of active
  190. use in numerous production software projects and many hundreds of improvements and
  191. community contributions.</para>
  192. <para>Acegi Security became an official Spring Portfolio project towards the end of 2007 and
  193. was rebranded as "Spring Security".</para>
  194. <para>Today Spring Security enjoys a strong and active open source community. There are
  195. thousands of messages about Spring Security on the support forums. There is an active
  196. core of developers work who work on the code itself and an active community which also
  197. regularly share patches and support their peers.</para>
  198. </sect1>
  199. <sect1 xml:id="release-numbering">
  200. <title>Release Numbering</title>
  201. <para>It is useful to understand how Spring Security release numbers work, as it will help
  202. you identify the effort (or lack thereof) involved in migrating to future releases of
  203. the project. Officially, we use the Apache Portable Runtime Project versioning
  204. guidelines, which can be viewed at
  205. <literal>http://apr.apache.org/versioning.html</literal>. We quote the introduction
  206. contained on that page for your convenience:</para>
  207. <para><quote>Versions are denoted using a standard triplet of integers: MAJOR.MINOR.PATCH.
  208. The basic intent is that MAJOR versions are incompatible, large-scale upgrades of
  209. the API. MINOR versions retain source and binary compatibility with older minor
  210. versions, and changes in the PATCH level are perfectly compatible, forwards and
  211. backwards.</quote></para>
  212. </sect1>
  213. <sect1 xml:id="get-source">
  214. <title>Getting the Source</title>
  215. <para> Since Spring Security is an Open Source project, we'd strongly encourage you to check
  216. out the source code using subversion. This will give you full access to all the sample
  217. applications and you can build the most up to date version of the project easily. Having
  218. the source for a project is also a huge help in debugging. Exception stack traces are no
  219. longer obscure black-box issues but you can get straight to the line that's causing the
  220. problem and work out what's happening. The source is the ultimate documentation for a
  221. project and often the simplest place to find out how something actually works. </para>
  222. <para> To obtain the source for the project trunk, use the following subversion command:
  223. <programlisting>
  224. svn checkout https://src.springframework.org/svn/spring-security/trunk/
  225. </programlisting>
  226. You can checkout specific versions from
  227. <literal>https://src.springframework.org/svn/spring-security/tags/</literal>.
  228. </para>
  229. </sect1>
  230. </chapter>