suggested.html 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <!--
  2. * ========================================================================
  3. *
  4. * Copyright 2004 Acegi Technology Pty Limited
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. *
  18. * ========================================================================
  19. -->
  20. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  21. <html xmlns="http://www.w3.org/1999/xhtml">
  22. <head>
  23. <title>Acegi Security Suggested Steps</title>
  24. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  25. </head>
  26. <body>
  27. <h1>Suggested Steps</h1>
  28. <p>Presented below are the steps we encourage you to take in order to gain the most
  29. out of Acegi Security in a realistic timeframe.
  30. <ol>
  31. <li>Your first step is to ensure you're able to actually build Acegi Security. This is
  32. because if you encounter any problems the first thing we'll probably suggest you do is
  33. upgrade to the latest CVS HEAD. It also means you can try things out if you get stuck,
  34. such as adding even more logging messages to the actual Acegi Security core code.
  35. The good news is building is actually very easy, and
  36. we've gone to a lot of trouble to document what is involved. If you have a working Maven
  37. installation, it <i>should</i> be as simple as two commands. Have a look on the
  38. <a href="building.html">Building with Maven</a> page, and follow the
  39. "Checking Out from CVS", "Installing commons-attributes-plugin", and
  40. "Building All JARs" steps. Of course, you can safely skip
  41. this step if you don't have time.<br><br>
  42. Estimated time: 30 minutes - 2 hours.<br><br>
  43. </li>
  44. <li>Next up gain a proper understanding of how the Contacts Sample application works.
  45. This will probably involve deploying <code>acegi-security-sample-contacts-filter.war</code>.<br><br>
  46. The actual <a target="_blank" class="newWindow" href="multiproject/acegi-security-sample-contacts/xref/index.html">java code</a>
  47. is a completely standard Spring application, except <code>ContactManagerBackend</code>
  48. which shows how we create and delete ACL permissions. The rest of the Java code has no
  49. security awareness, with all security services being declared in the XML files
  50. (don't worry, there aren't any new XML formats to learn: they're all standard Spring IoC container
  51. declarations or the stock-standard <code>web.xml</code>). The main
  52. XML files to review are
  53. <a target="_blank" class="newWindow" href="http://cvs.sourceforge.net/viewcvs.py/acegisecurity/acegisecurity/samples/contacts/src/main/webapp/filter/WEB-INF/applicationContext-acegi-security.xml?view=auto">applicationContext-acegi-security.xml</a> (from the filter webapp),
  54. <a target="_blank" class="newWindow" href="http://cvs.sourceforge.net/viewcvs.py/acegisecurity/acegisecurity/samples/contacts/src/main/webapp/common/WEB-INF/applicationContext-common-authorisation.xml?view=auto">applicationContext-common-authorisation.xml</a>,
  55. <a target="_blank" class="newWindow" href="http://cvs.sourceforge.net/viewcvs.py/acegisecurity/acegisecurity/samples/contacts/src/main/webapp/common/WEB-INF/applicationContext-common-business.xml?view=auto">applicationContext-common-business.xml</a> (just note we add <code>contactManagerSecurity</code> to the services layer target bean), and
  56. <a target="_blank" class="newWindow" href="http://cvs.sourceforge.net/viewcvs.py/acegisecurity/acegisecurity/samples/contacts/src/main/webapp/filter/WEB-INF/web.xml?view=auto">web.xml</a> (from the filter webapp).
  57. The XML definitions are comprehensively discussed in the
  58. <a href="reference.html">Reference Guide</a>.
  59. <br><br>
  60. To gain the most from reviewing these XML files, we suggest you start by understanding how
  61. authentication takes place. There's not much point knowing all about authorisation until authentication is
  62. really clear, especially the interaction between the <code>ContextHolder</code>, the
  63. authentication mechanism (such as <code>AuthenticationProcessingFilter</code>), the
  64. authentication commencement process (specifically <code>SecurityEnforcementFilter</code> and
  65. say <code>AuthenticationProcessingFilterEntryPoint</code>), and the system that manages authentication
  66. data between invocations (say <code>HttpSessionIntegrationFilter</code>). You don't have to
  67. know every detail, just basically what they do and the key differences (again, the
  68. reference guide should help considerably, as there are diagrams etc).
  69. <br><br>
  70. Once you understand authentication in the contacts Sample application, look at how authorisation
  71. is handled. Start with <code>FilterSecurityInterceptor</code>'s role and how its
  72. regular expression or Ant paths protect URIs. Next up explore how <code>RoleVoter</code>
  73. works in our sample application with the <code>FilterSecurityInterceptor</code> and
  74. <code>MethodSecurityInterceptor</code>. Finally, review what the
  75. <code>BasicAclEntryVoter</code> does in our sample application, in terms of protecting
  76. domain objects from method invocations the principal does not have permission to.
  77. <br><br>Lastly, get an understanding of how the <code>AfterInvocationProviderManager</code>
  78. is being used to stop domain objects being returned to which the principal has no
  79. permission, and to filter <code>Collection</code>s so they don't contain domain objects to
  80. which the principal has no permission. By all means comment out parts of the Spring IoC XML
  81. and see the effect. For example, comment out the <code>AfterInvocationProviderManager</code> (of course, remove its reference
  82. in the <code>MethodSecurityInterceptor</code>) and see how all of the contacts get returned.
  83. <br><br>
  84. Estimated time: 1-2 days.<br><br>
  85. </li>
  86. <li>By now you will have a good grasp on how Acegi Security works, and all that is left to
  87. do is design your own application's implementation. The way we suggested you explore the Contacts Sample
  88. is the same way we suggest you implement security in your own application: start with authentication,
  89. then add basic web request URI security. Follow it with the standard role voter to protect
  90. method invocations. Finally, and only if your application actually needs it, introduce
  91. domain object security with the <code>BasicAclEntryVoter</code> and
  92. <code>AfterInvocationProviderManager</code>.
  93. <br><br>
  94. We do not encourage you to use CAS, container adapters, BASIC authentication, transparent
  95. RMI invocation, run-as replacement, rich client integration or any of the other interesting features
  96. of Acegi Security until you've got a "bare bones" installation working with <code>DaoAuthenticationProvider</code>,
  97. one of Acegi Security's <code>AuthenticationDao</code>s (or your own), and your basic
  98. authorisation configuration. Like anything, start with something simple and build on it
  99. (this would be the opposite advice if you were building your own security framework,
  100. where you would need to cross the highest and most difficult bridges first, to check they
  101. are actually possible).<br><br>
  102. If you've followed the steps above, and refer back to the
  103. <a href="reference.html">Reference Guide</a>,
  104. <a href="http://www.springframework.org">forums</a>, and
  105. <a href="faq.html">FAQ</a>
  106. for help, you'll find it pretty easy to implement Acegi Security in your application.
  107. Most importantly, you'll be using a security framework that offers you complete container
  108. portability, flexibility, and community support - without needing to write and maintain your
  109. own code.<br><br>
  110. Estimated time: 1-5 days.<br><br>
  111. </br>
  112. </li>
  113. </ol>
  114. <p>Please note the time estimates are just that: estimates. They will vary considerably depending
  115. on how much experience you have, particularly with Java and Spring. They will also vary depending
  116. on how complex your intended security-enabled application will be. Some people need to push the domain
  117. object instance access control list capabilities to the maximum, whilst others don't even need anything
  118. beyond web request URI security. The good thing is Acegi Security will either directly support your future
  119. needs, or provide a clearly-defined extension point for addressing them.
  120. <p>
  121. We welcome your feedback about how long it has actually taken you to complete each step, so we
  122. can update this page and help new users better assess their project timetables in the future.
  123. Any other tips on what you found helpful in learning Acegi Security are also very welcome.
  124. </body>
  125. </html>