Class SAML2Profile

java.lang.Object
org.pac4j.core.profile.BasicUserProfile
org.pac4j.core.profile.CommonProfile
org.pac4j.saml.profile.SAML2Profile
All Implemented Interfaces:
Externalizable, 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:
  • Constructor Details

    • SAML2Profile

      public SAML2Profile()

      Constructor for 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 Details

    • getNotBefore

      public ZonedDateTime getNotBefore()

      getNotBefore.

      Returns:
      a ZonedDateTime object
    • setNotBefore

      public void setNotBefore(ZonedDateTime notBefore)

      setNotBefore.

      Parameters:
      notBefore - a ZonedDateTime object
    • getNotOnOrAfter

      public ZonedDateTime getNotOnOrAfter()

      getNotOnOrAfter.

      Returns:
      a ZonedDateTime object
    • setNotOnOrAfter

      public void setNotOnOrAfter(ZonedDateTime notOnOrAfter)

      setNotOnOrAfter.

      Parameters:
      notOnOrAfter - a ZonedDateTime object
    • getSessionIndex

      public String getSessionIndex()

      getSessionIndex.

      Returns:
      a String object
    • setSessionIndex

      public void setSessionIndex(String sessionIndex)

      setSessionIndex.

      Parameters:
      sessionIndex - a String object
    • getIssuerEntityID

      public String getIssuerEntityID()

      getIssuerEntityID.

      Returns:
      a String object
    • setIssuerEntityID

      public void setIssuerEntityID(String issuerEntityID)

      setIssuerEntityID.

      Parameters:
      issuerEntityID - a String object
    • getAuthnContexts

      public List<String> getAuthnContexts()

      getAuthnContexts.

      Returns:
      a List object
    • setAuthnContexts

      public void setAuthnContexts(List<String> authnContexts)

      setAuthnContexts.

      Parameters:
      authnContexts - a List object
    • getSamlNameIdFormat

      public String getSamlNameIdFormat()

      getSamlNameIdFormat.

      Returns:
      a String object
    • setSamlNameIdFormat

      public void setSamlNameIdFormat(String samlNameIdFormat)

      setSamlNameIdFormat.

      Parameters:
      samlNameIdFormat - a String object
    • getSamlNameIdNameQualifier

      public String getSamlNameIdNameQualifier()

      getSamlNameIdNameQualifier.

      Returns:
      a String object
    • setSamlNameIdNameQualifier

      public void setSamlNameIdNameQualifier(String samlNameIdNameQualifier)

      setSamlNameIdNameQualifier.

      Parameters:
      samlNameIdNameQualifier - a String object
    • getSamlNameIdSpNameQualifier

      public String getSamlNameIdSpNameQualifier()

      getSamlNameIdSpNameQualifier.

      Returns:
      a String object
    • setSamlNameIdSpNameQualifier

      public void setSamlNameIdSpNameQualifier(String samlNameIdSpNameQualifier)

      setSamlNameIdSpNameQualifier.

      Parameters:
      samlNameIdSpNameQualifier - a String object
    • getSamlNameIdSpProviderId

      public String getSamlNameIdSpProviderId()

      getSamlNameIdSpProviderId.

      Returns:
      a String object
    • setSamlNameIdSpProviderId

      public void setSamlNameIdSpProviderId(String samlNameIdSpProviderId)

      setSamlNameIdSpProviderId.

      Parameters:
      samlNameIdSpProviderId - a String object