2
0

upgrade-05-06.txt 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. $Id$