Class SAMLEncoderSupport
java.lang.Object
net.shibboleth.idp.saml.attribute.transcoding.SAMLEncoderSupport
Support class for encoding IdP Attributes and their value.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic XMLObject
encodeByteArrayValue
(IdPAttribute attribute, QName attributeValueElementName, byte[] value, boolean withType) Base64 encodes abyte[]
into a SAML attribute value element.static XMLObject
encodeScopedStringValueAttribute
(IdPAttribute attribute, QName attributeValueElementName, ScopedStringAttributeValue value, String scopeAttributeName, boolean withType) Encode aScopedStringAttributeValue
value in to an SAML attribute value element using the (older Shibboleth) sytnax where the scope is inside an XML attribute.static XMLObject
encodeScopedStringValueInline
(IdPAttribute attribute, QName attributeValueElementName, ScopedStringAttributeValue value, String scopeDelimiter, boolean withType) Encode aScopedStringAttributeValue
value into a SAML attribute value element using the "inline" syntax where the scope and value are combined into a string.static XMLObject
encodeStringValue
(IdPAttribute attribute, QName attributeValueElementName, String value, boolean withType) Encodes a String value into a SAML attribute value element.static XMLObject
encodeXMLObjectValue
(IdPAttribute attribute, QName attributeValueElementName, XMLObject value)
-
Field Details
-
LOG
@Nonnull private static final org.slf4j.Logger LOGClass logger.
-
-
Constructor Details
-
SAMLEncoderSupport
private SAMLEncoderSupport()Constructor.
-
-
Method Details
-
encodeStringValue
@Nullable public static XMLObject encodeStringValue(@Nonnull IdPAttribute attribute, @Nonnull QName attributeValueElementName, @Nullable String value, boolean withType) Encodes a String value into a SAML attribute value element.- Parameters:
attribute
- attribute to be encodedattributeValueElementName
- the element name to createvalue
- value to encodedwithType
- whether to include xsi:type- Returns:
- the attribute value element or null if the given value was null or empty
-
encodeByteArrayValue
@Nullable public static XMLObject encodeByteArrayValue(@Nonnull IdPAttribute attribute, @Nonnull QName attributeValueElementName, @Nullable byte[] value, boolean withType) throws EncodingException Base64 encodes abyte[]
into a SAML attribute value element.- Parameters:
attribute
- attribute to be encodedattributeValueElementName
- the element name to createvalue
- value to encodedwithType
- whether to include xsi:type- Returns:
- the attribute value element or null if the given value was null or empty
- Throws:
EncodingException
- if the byte array can not be base64 encoded.
-
encodeXMLObjectValue
@Nullable public static XMLObject encodeXMLObjectValue(@Nonnull IdPAttribute attribute, @Nonnull QName attributeValueElementName, @Nullable XMLObject value) - Parameters:
attribute
- attribute to be encodedattributeValueElementName
- the SAML 1 or SAML 1 attribute namevalue
- value to encoded- Returns:
- the attribute value element or null if the given value was null or empty
-
encodeScopedStringValueAttribute
public static XMLObject encodeScopedStringValueAttribute(@Nonnull IdPAttribute attribute, @Nonnull QName attributeValueElementName, @Nullable ScopedStringAttributeValue value, @Nonnull @NotEmpty String scopeAttributeName, boolean withType) Encode aScopedStringAttributeValue
value in to an SAML attribute value element using the (older Shibboleth) sytnax where the scope is inside an XML attribute.- Parameters:
attribute
- attribute to be encodedattributeValueElementName
- the element name to createvalue
- value to encodedscopeAttributeName
- the name that the attribute will be givenwithType
- whether to include xsi:type- Returns:
- the attribute value element or null if the given value was null or empty
-
encodeScopedStringValueInline
public static XMLObject encodeScopedStringValueInline(@Nonnull IdPAttribute attribute, @Nonnull QName attributeValueElementName, @Nullable ScopedStringAttributeValue value, @Nonnull String scopeDelimiter, boolean withType) Encode aScopedStringAttributeValue
value into a SAML attribute value element using the "inline" syntax where the scope and value are combined into a string.- Parameters:
attribute
- attribute to be encodedattributeValueElementName
- the element name to createvalue
- value to encodedscopeDelimiter
- the delimiter to put between the value and the scopewithType
- whether to include xsi:type- Returns:
- the attribute value element or null if the given value was null or empty
-