Class SAML2Profile

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, org.pac4j.core.profile.UserProfile

    public class SAML2Profile
    extends org.pac4j.core.profile.CommonProfile

    This class is the user profile for sites using SAML2 protocol.

    It is returned by the SAML2Client.

    Version:
    1.5.0
    Author:
    Michael Remond, Misagh Moayyed, Ruochao Zheng
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class org.pac4j.core.profile.BasicUserProfile

        logger
    • Constructor Summary

      Constructors 
      Constructor Description
      SAML2Profile()  
      SAML2Profile​(boolean canMergeAttributes)
      Create a profile with possibility to merge attributes with the same name and collection-type values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<java.lang.String> getAuthnContexts()  
      java.lang.String getIssuerEntityID()  
      java.time.ZonedDateTime getNotBefore()  
      java.time.ZonedDateTime getNotOnOrAfter()  
      java.lang.String getSamlNameIdFormat()  
      java.lang.String getSamlNameIdNameQualifier()  
      java.lang.String getSamlNameIdSpNameQualifier()  
      java.lang.String getSamlNameIdSpProviderId()  
      java.lang.String getSessionIndex()  
      • Methods inherited from class org.pac4j.core.profile.CommonProfile

        getAttributeAsDate, getDisplayName, getEmail, getFamilyName, getFirstName, getGender, getLocale, getLocation, getPictureUrl, getProfileUrl, getUsername, isExpired
      • Methods inherited from class org.pac4j.core.profile.BasicUserProfile

        addAttribute, addAttributes, addAuthenticationAttribute, addAuthenticationAttributes, addPermission, addPermissions, addRole, addRoles, asPrincipal, build, build, containsAttribute, containsAuthenicationAttribute, extractAttributeValues, getAttribute, getAttribute, getAttributes, getAuthenticationAttribute, getAuthenticationAttribute, getAuthenticationAttributes, getClientName, getId, getLinkedId, getPermissions, getRoles, getTypedId, isRemembered, readExternal, removeAttribute, removeAuthenticationAttribute, removeLoginData, setClientName, setId, setLinkedId, setPermissions, setRemembered, setRoles, toString, writeExternal
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SAML2Profile

        public SAML2Profile()
      • SAML2Profile

        public SAML2Profile​(boolean canMergeAttributes)
        Create a profile with possibility to merge attributes with the same name and collection-type values. In SAML2 it's very important to get full collection of roles which are received in separate single-element collections.

        In order to use it you may initialize the client in the following way:

         SAML2Client client = new SAML2Client();
         SAML2ClientConfiguration config = new SAML2ClientConfiguration();
         SAML2Authenticator authenticator = new SAML2Authenticator(config.getAttributeAsId());
         boolean canMergeAttributes = true;
         authenticator.setProfileDefinition(new CommonProfileDefinition<>(x → new SAML2Profile(canMergeAttributes)));
         client.setAuthenticator(authenticator);
         
        Parameters:
        canMergeAttributes - if true - merge attributes with the same name and collection-type values, if false - overwrite them.
        Since:
        3.1.0
    • Method Detail

      • getNotBefore

        public java.time.ZonedDateTime getNotBefore()
      • getNotOnOrAfter

        public java.time.ZonedDateTime getNotOnOrAfter()
      • getSessionIndex

        public java.lang.String getSessionIndex()
      • getIssuerEntityID

        public java.lang.String getIssuerEntityID()
      • getAuthnContexts

        public java.util.List<java.lang.String> getAuthnContexts()
      • getSamlNameIdFormat

        public java.lang.String getSamlNameIdFormat()
      • getSamlNameIdNameQualifier

        public java.lang.String getSamlNameIdNameQualifier()
      • getSamlNameIdSpNameQualifier

        public java.lang.String getSamlNameIdSpNameQualifier()
      • getSamlNameIdSpProviderId

        public java.lang.String getSamlNameIdSpProviderId()