Announcement Announcement Module
Collapse
No announcement yet.
How can I get a hold of OpenID attributes in UserDetailsService? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I get a hold of OpenID attributes in UserDetailsService?

    I am trying to get to them by calling SecurityContextHolder.getContext().getAuthenticati on() but apparently the Authentication is empty at this point.

  • #2
    Originally posted by kdekooter View Post
    I am trying to get to them by calling SecurityContextHolder.getContext().getAuthenticati on() but apparently the Authentication is empty at this point.
    Your AuthenticationUserDetailsService.loadUserDetails() implementation gets an OpenIDAuthenticationToken as input param. Run .getAttributes() on that.

    Comment


    • #3
      Also, make sure that you check after the user has returned from the OpenID provider. Also note that the actual availability of attributes varies widely by provider, so depending on the provider the user is authenticating with, you may or may not get attributes you want (e.g. email).

      Comment


      • #4
        Originally posted by pmularien View Post
        Also, make sure that you check after the user has returned from the OpenID provider...
        I don't know what you mean. Unless I'm misunderstanding the process, loadUserDetails is only ever called after the user has returned from the OpenID provider. How else could the provider-supplied attribute list be provided for examination?

        Comment


        • #5
          That sounds promising! How would I have to configure this?

          This is a snippet of my current context:
          Code:
              <authentication-manager>
                  <authentication-provider user-service-ref="combinedUserDetailsService"/>
              </authentication-manager>
          An implentation of AuthenticationUserDetailsService is not accepted as an authentication provider.

          Comment


          • #6
            Originally posted by Kees de Kooter View Post
            That sounds promising! How would I have to configure this?
            Study the openid sample webapp.

            Comment


            • #7
              Thanks Blaine,

              I agree that I should do my own homework ;-). However the openid sample app does not give me a clue of how to configure this. No AuthenticationUserDetailsService in sight.

              Please note that I am using Spring Security 3.0.5.
              Last edited by Kees de Kooter; Mar 23rd, 2011, 03:09 PM.

              Comment


              • #8
                Originally posted by Kees de Kooter View Post
                Thanks Blaine,

                I agree that I should do my own homework ;-). However the openid sample app does not give me a clue of how to configure this. No AuthenticationUserDetailsService in sight.

                Please note that I am using Spring Security 3.0.5.
                Giving you the benefit of the doubt-- get the sample from the tip of the master branch. Not 100% that everything will work like in 3.0.5, but I suspect it's very close. If you still say it doesn't show how to configure and you don't see an AuthenticationUserDetailsService, you are not expending as much effort as I have expended in answering you.
                Last edited by blaine; Mar 23rd, 2011, 03:27 PM. Reason: inserted word for clarity

                Comment

                Working...
                X