Package org.pac4j.saml.profile
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:
-
Field Summary
Fields inherited from class org.pac4j.core.profile.BasicUserProfile
logger -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for SAML2Profile.SAML2Profile(boolean canMergeAttributes) Create a profile with possibility to merge attributes with the same name and collection-type values. -
Method Summary
Modifier and TypeMethodDescriptiongetAuthnContexts.getIssuerEntityID.getNotBefore.getNotOnOrAfter.getSamlNameIdFormat.getSamlNameIdNameQualifier.getSamlNameIdSpNameQualifier.getSamlNameIdSpProviderId.getSessionIndex.voidsetAuthnContexts(List<String> authnContexts) setAuthnContexts.voidsetIssuerEntityID(String issuerEntityID) setIssuerEntityID.voidsetNotBefore(ZonedDateTime notBefore) setNotBefore.voidsetNotOnOrAfter(ZonedDateTime notOnOrAfter) setNotOnOrAfter.voidsetSamlNameIdFormat(String samlNameIdFormat) setSamlNameIdFormat.voidsetSamlNameIdNameQualifier(String samlNameIdNameQualifier) setSamlNameIdNameQualifier.voidsetSamlNameIdSpNameQualifier(String samlNameIdSpNameQualifier) setSamlNameIdSpNameQualifier.voidsetSamlNameIdSpProviderId(String samlNameIdSpProviderId) setSamlNameIdSpProviderId.voidsetSessionIndex(String sessionIndex) setSessionIndex.Methods inherited from class org.pac4j.core.profile.CommonProfile
getAttributeAsDate, getAttributeAsString, getAttributeAsType, getDisplayName, getEmail, getFamilyName, getFirstName, getGender, getLocale, getLocation, getPictureUrl, getProfileUrl, getUsername, isExpired, toStringMethods inherited from class org.pac4j.core.profile.BasicUserProfile
addAttribute, addAttributes, addAuthenticationAttribute, addAuthenticationAttributes, addRole, addRoles, asPrincipal, build, build, canEqual, containsAttribute, containsAuthenticationAttribute, equals, extractAttributeValues, getAttribute, getAttribute, getAttributes, getAuthenticationAttribute, getAuthenticationAttribute, getAuthenticationAttributes, getClientName, getId, getLinkedId, getRoles, getTypedId, hashCode, isRemembered, readExternal, removeAttribute, removeAuthenticationAttribute, removeLoginData, setClientName, setId, setLinkedId, setRemembered, setRoles, writeExternal
-
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
getNotBefore.
- Returns:
- a
ZonedDateTimeobject
-
setNotBefore
setNotBefore.
- Parameters:
notBefore- aZonedDateTimeobject
-
getNotOnOrAfter
getNotOnOrAfter.
- Returns:
- a
ZonedDateTimeobject
-
setNotOnOrAfter
setNotOnOrAfter.
- Parameters:
notOnOrAfter- aZonedDateTimeobject
-
getSessionIndex
getSessionIndex.
- Returns:
- a
Stringobject
-
setSessionIndex
setSessionIndex.
- Parameters:
sessionIndex- aStringobject
-
getIssuerEntityID
getIssuerEntityID.
- Returns:
- a
Stringobject
-
setIssuerEntityID
setIssuerEntityID.
- Parameters:
issuerEntityID- aStringobject
-
getAuthnContexts
getAuthnContexts.
- Returns:
- a
Listobject
-
setAuthnContexts
setAuthnContexts.
- Parameters:
authnContexts- aListobject
-
getSamlNameIdFormat
getSamlNameIdFormat.
- Returns:
- a
Stringobject
-
setSamlNameIdFormat
setSamlNameIdFormat.
- Parameters:
samlNameIdFormat- aStringobject
-
getSamlNameIdNameQualifier
getSamlNameIdNameQualifier.
- Returns:
- a
Stringobject
-
setSamlNameIdNameQualifier
setSamlNameIdNameQualifier.
- Parameters:
samlNameIdNameQualifier- aStringobject
-
getSamlNameIdSpNameQualifier
getSamlNameIdSpNameQualifier.
- Returns:
- a
Stringobject
-
setSamlNameIdSpNameQualifier
setSamlNameIdSpNameQualifier.
- Parameters:
samlNameIdSpNameQualifier- aStringobject
-
getSamlNameIdSpProviderId
getSamlNameIdSpProviderId.
- Returns:
- a
Stringobject
-
setSamlNameIdSpProviderId
setSamlNameIdSpProviderId.
- Parameters:
samlNameIdSpProviderId- aStringobject
-