Announcement Announcement Module
Collapse
No announcement yet.
SAML: Populating the UserDetails object Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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;
        }

    Comment

    Working...
    X