upgrade-05-06.txt 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. ===============================================================================
  2. ACEGI SECURITY SYSTEM FOR SPRING - UPGRADING FROM 0.5 TO 0.6
  3. ===============================================================================
  4. The following should help most casual users of the project update their
  5. applications:
  6. - Locate and remove all property references to
  7. DaoAuthenticationProvider.key and
  8. DaoAuthenticationProvider.refreshTokenInterval.
  9. - If you are using DaoAuthenticationProvider and either (i) you are using
  10. container adapters or (ii) your code relies on the Authentication object
  11. having its getPrincipal() return a String, you must set the new
  12. DaoAuthenticationProvider property, forcePrincipalAsString, to true.
  13. By default DaoAuthenticationProvider returns an Authentication object
  14. containing the relevant User, which allows access to additional properties.
  15. Where possible, we recommend you change your code to something like this,
  16. so that you can leave forcePrincipalAsString to the false default:
  17. String username = authentication.getPrincipal();
  18. if (authentication.getPrincipal() instanceof User) {
  19. username = ((User) authentication.getPrincipal()).getUsername();
  20. }
  21. - The signature of AuthenticationDaos have changed. In concrete
  22. implementations, modify the User to UserDetails, as shown below:
  23. public User loadUserByUsername(String username)
  24. throws UsernameNotFoundException, DataAccessException {
  25. to:
  26. public UserDetails loadUserByUsername(String username)
  27. throws UsernameNotFoundException, DataAccessException {
  28. Existing concrete implementations would be returning User, which implements
  29. UserDetails, so no further code changes should be required.
  30. - Similar signature changes (User -> UserDetails) are also required to any
  31. custom implementations of UserCache and SaltSource.
  32. - Any custom event listeners relying on AuthenticationEvent should note a
  33. UserDetails is now provided in the AuthenticationEvent (not a User).
  34. - CAS users should note the CasAuthoritiesPopulator interface signature has
  35. changed. Most CAS users will be using DaoCasAuthoritiesPopulator, so this
  36. change is unlikely to require any action.
  37. - Please check your web.xml for whether you are using AutoIntegrationFilter.
  38. Previously this class was loaded directly by web.xml as a filter. It is
  39. now recommended to load it via FilterToBeanProxy and define it as a
  40. bean in your application context. This usually involves making the entry
  41. in web.xml match the following:
  42. <filter>
  43. <filter-name>Acegi Security System for Spring Auto Integration Filter</filter-name>
  44. <filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
  45. <init-param>
  46. <param-name>targetClass</param-name>
  47. <param-value>net.sf.acegisecurity.ui.AutoIntegrationFilter</param-value>
  48. </init-param>
  49. </filter>
  50. Then add the following to applicationContext.xml:
  51. <bean id="autoIntegrationFilter" class="net.sf.acegisecurity.ui.AutoIntegrationFilter" />
  52. $Id$