Package io.jmix.saml.util
Class SamlAssertionUtils
java.lang.Object
io.jmix.saml.util.SamlAssertionUtils
Utility class that provides some methods for working with SAML assertions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAssertionAttributes(org.opensaml.saml.saml2.core.Assertion assertion) Extracts all attributes from the assertion.static @Nullable StringgetFirstAttributeValue(org.opensaml.saml.saml2.core.Assertion assertion, String attributeName) Returns the first value of the given assertion attribute.static @Nullable org.opensaml.saml.saml2.core.NameIDgetNameId(org.opensaml.saml.saml2.core.Assertion assertion) Returns the plainNameIDof the assertion subject.getSessionIndexes(org.opensaml.saml.saml2.core.Assertion assertion) Extracts session indexes from authentication statements of the assertion.static @Nullable StringgetUsername(org.opensaml.saml.saml2.core.Assertion assertion) Returns username from the assertion.protected static @Nullable ObjectgetXmlObjectValue(org.opensaml.core.xml.XMLObject xmlObject)
-
Constructor Details
-
SamlAssertionUtils
public SamlAssertionUtils()
-
-
Method Details
-
getAssertionAttributes
public static Map<String,List<Object>> getAssertionAttributes(org.opensaml.saml.saml2.core.Assertion assertion) Extracts all attributes from the assertion.- Parameters:
assertion- SAML assertion- Returns:
- map of attribute names to attribute values
-
getSessionIndexes
Extracts session indexes from authentication statements of the assertion. Session indexes identify the user session on the identity provider and must be sent back in theLogoutRequestduring single logout.- Parameters:
assertion- SAML assertion- Returns:
- list of session indexes
-
getUsername
Returns username from the assertion. The username is taken from the plainNameIDof the assertion subject.- Parameters:
assertion- SAML assertion- Returns:
- username, or null if the assertion contains no subject, no plain
NameID(e.g. the identity provider releases anEncryptedID), or theNameIDhas no value
-
getNameId
public static @Nullable org.opensaml.saml.saml2.core.NameID getNameId(org.opensaml.saml.saml2.core.Assertion assertion) Returns the plainNameIDof the assertion subject.- Parameters:
assertion- SAML assertion- Returns:
- NameID, or null if the assertion contains no subject or no plain
NameID
-
getFirstAttributeValue
public static @Nullable String getFirstAttributeValue(org.opensaml.saml.saml2.core.Assertion assertion, String attributeName) Returns the first value of the given assertion attribute.- Parameters:
assertion- SAML assertionattributeName- name of the assertion attribute- Returns:
- first attribute value converted to string, or null if the attribute is absent or has no values
-
getXmlObjectValue
-