Class SAMLEncoderSupport
- java.lang.Object
-
- net.shibboleth.idp.saml.attribute.transcoding.SAMLEncoderSupport
-
public final class SAMLEncoderSupport extends Object
Support class for encoding IdP Attributes and their value.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.LoggerLOGClass logger.
-
Constructor Summary
Constructors Modifier Constructor Description privateSAMLEncoderSupport()Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static XMLObjectencodeByteArrayValue(IdPAttribute attribute, QName attributeValueElementName, byte[] value, boolean withType)Base64 encodes abyte[]into a SAML attribute value element.static XMLObjectencodeDateTimeValue(IdPAttribute attribute, QName attributeValueElementName, Instant value, boolean withType)Encodes a date/time value into a SAML attribute value element.static XMLObjectencodeScopedStringValueAttribute(IdPAttribute attribute, QName attributeValueElementName, ScopedStringAttributeValue value, String scopeAttributeName, boolean withType)Encode aScopedStringAttributeValuevalue in to an SAML attribute value element using the (older Shibboleth) sytnax where the scope is inside an XML attribute.static XMLObjectencodeScopedStringValueInline(IdPAttribute attribute, QName attributeValueElementName, ScopedStringAttributeValue value, String scopeDelimiter, boolean withType)Encode aScopedStringAttributeValuevalue into a SAML attribute value element using the "inline" syntax where the scope and value are combined into a string.static XMLObjectencodeStringValue(IdPAttribute attribute, QName attributeValueElementName, String value, boolean withType)Encodes a String value into a SAML attribute value element.static XMLObjectencodeXMLObjectValue(IdPAttribute attribute, QName attributeValueElementName, XMLObject value)
-
-
-
Method Detail
-
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 aScopedStringAttributeValuevalue 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 aScopedStringAttributeValuevalue 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
-
encodeDateTimeValue
@Nullable public static XMLObject encodeDateTimeValue(@Nonnull IdPAttribute attribute, @Nonnull QName attributeValueElementName, @Nullable Instant value, boolean withType)
Encodes a date/time 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
- Since:
- 4.3.0
-
-