Results 1 to 8 of 8

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

  1. #1
    Join Date
    Jul 2005
    Posts
    2

    Default 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. #2

    Default

    Quote 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.

  3. #3
    Join Date
    Sep 2004
    Location
    Manchester, NH
    Posts
    1,236

    Default

    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).
    Peter Mularien | Blog
    Author, Spring Security 3 (Book) - Packt Publishing, Available in print and eBook form
    SCJP 5, Oracle DBA
    Any postings are my own opinion, and should not be attributed to my employer or clients.


  4. #4

    Default

    Quote 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?

  5. #5
    Join Date
    Dec 2004
    Location
    Rotterdam, The Netherlands
    Posts
    162

    Default

    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.
    Kees de Kooter
    www.boplicity.net

  6. #6

    Default

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

  7. #7
    Join Date
    Dec 2004
    Location
    Rotterdam, The Netherlands
    Posts
    162

    Default

    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 at 03:09 PM.
    Kees de Kooter
    www.boplicity.net

  8. #8

    Default

    Quote 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 at 03:27 PM. Reason: inserted word for clarity

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •