Announcement Announcement Module
Collapse
No announcement yet.
Encorporating Custom UserDetails Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Encorporating Custom UserDetails

    Hi

    I cannot find anywhere in the docs or this forum where it is possible to either a) add properties to UserDetails or b) (what I really want todo) use my own customer User object?

    I know it is possible but how to you encorporate your own User object? I can no doubt do it by overriding existing providers/filters, but is there a cleaner / easier way?

    Any help would be appreciated..

  • #2
    Nearly every deployment of Acegi Security will use DaoAuthenticationProvider, which needs an AuthenticationDao, and most people write their own AuthenticationDao. The AuthenticationDao needs to return a UserDetails implementation. Generally people return either User (which implements UserDetails) or a subclass of User, although naturally you're free to write your own UserDetails implementation.

    Comment


    • #3
      UserDetails

      ok thanks,

      I thought they maybe a:

      <param>userclass</param>
      <value>my.com.UserDetails</value>

      type thing for the Authenticator that would allow me to pass in my custom class, and then the authenticator use that (using reflection)..

      Comment


      • #4
        Say the AuthenticationProvider created an instance of the class you specified, what would then populate it?

        Using the UserDetails approach will make the UserDetails object available from Authentication.getPrincipal().

        Comment

        Working...
        X