Results 1 to 2 of 2

Thread: SAML: Populating the UserDetails object

Hybrid View

  1. #1
    Join Date
    Aug 2008
    Location
    Oslo
    Posts
    23

    Question SAML: Populating the UserDetails object

    I have successfully implemented the SAML extenstion to my project. But I cannot figure out how to populate my UserDetails object. I read the documentation Vladimir Schäfer wrote about this, but unfortunately I do not understand what to do.

    In another project using LdapAuthenticationProvider, I created an LdapAuthoritiesPopulator which populated the UserDetails object. But how do I do this using the SAML extenstion?

  2. #2
    Join Date
    Aug 2008
    Location
    Oslo
    Posts
    23

    Thumbs up

    I figured it out. I populated my UserDetails object inside the loadUserBySAML method I had to create when I implemented the SAMLUserDetailsService interface.

    I also created a helper method for getting the attributes:
    Code:
    private String getAttributeByName(final String name, final SAMLCredential credential) {
            Attribute attribute = credential.getAttributeByName(name);
            String output = "";
            if (attribute != null) {
                List<XMLObject> attributes = attribute.getAttributeValues();
                if (attributes.size() > 0) {
                    for (XMLObject object : attributes) {
                        XSString string = (XSString) object;
                        output += string.getValue() + ", ";
                    }
                    return output.substring(0, output.length() - 2);
                }
            }
            return output;
        }

Tags for this Thread

Posting Permissions

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