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 Details

    • LOG

      @Nonnull private static final org.slf4j.Logger LOG
      Class 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 encoded
      attributeValueElementName - the element name to create
      value - value to encoded
      withType - 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 a byte[] into a SAML attribute value element.
      Parameters:
      attribute - attribute to be encoded
      attributeValueElementName - the element name to create
      value - value to encoded
      withType - 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)
      Encodes an XMLObject value in to a XSAny SAML attribute value.
      Parameters:
      attribute - attribute to be encoded
      attributeValueElementName - the SAML 1 or SAML 1 attribute name
      value - 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 a ScopedStringAttributeValue 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 encoded
      attributeValueElementName - the element name to create
      value - value to encoded
      scopeAttributeName - the name that the attribute will be given
      withType - 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 a ScopedStringAttributeValue 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 encoded
      attributeValueElementName - the element name to create
      value - value to encoded
      scopeDelimiter - the delimiter to put between the value and the scope
      withType - 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 encoded
      attributeValueElementName - the element name to create
      value - value to encoded
      withType - whether to include xsi:type
      Returns:
      the attribute value element or null if the given value was null or empty
      Since:
      4.3.0