Class AttrValueSupport

java.lang.Object
org.sourceid.saml20.adapter.attribute.AttrValueSupport

public class AttrValueSupport extends Object
A helper class to make and convert an AttributeValue.
  • Constructor Details

    • AttrValueSupport

      public AttrValueSupport()
  • Method Details

    • make

      public static AttributeValue make(Object obj)
      Creates an AttributeValue from the String representation of the specified object. The String representation is not trimmed.
      Parameters:
      obj - The value of the returned AttributeValue.
      Returns:
      A new AttributeValue or obj if obj is an instance of AttributeValue.
    • make

      public static AttributeValue make(Object obj, boolean trim)
      Creates an AttributeValue from the String representation of the specified object.
      Parameters:
      obj - The value of the returned AttributeValue.
      trim - Whether the value should be trimmed.
      Returns:
      A new AttributeValue or obj if obj is an instance of AttributeValue.
    • make

      public static AttributeValue make(Collection<?> objs)
      Creates an AttributeValue from the Collection of objects. The String representation each object is added as a value. The String representations are not trimmed.
      Parameters:
      objs - The values of the returned AttributeValue.
      Returns:
      A new AttributeValue.
    • make

      public static AttributeValue make(Collection<?> objs, boolean trimValues)
      Creates an AttributeValue from the Collection of objects. The String representation each object is added as a value.
      Parameters:
      objs - The values of the returned AttributeValue.
      trimValues - Whether the values should be trimmed.
      Returns:
      A new AttributeValue.
    • convert

      public static AttributeMap convert(Map<String,Object> srcMap, boolean maskAll)
      Converts the specified map to an AttributeMap by calling make(Object) on each map value. Ognl values are not masked.
      Parameters:
      srcMap - The map to convert.
      maskAll - Whether all the values should be masked.
      Returns:
      A new AttributeMap.
    • convert

      public static AttributeMap convert(Map<String,Object> srcMap, boolean maskAll, boolean trim)
      Converts the specified map to an AttributeMap by calling make(Object, boolean) on each map value. Ognl values are not masked.
      Parameters:
      srcMap - The map to convert.
      maskAll - Whether all the values should be masked.
      trim - Whether or not each value should be trimmed.
      Returns:
      A new AttributeMap.
    • convert

      public static AttributeMap convert(Map<String,Object> srcMap, Set<String> maskedKeySet, boolean maskOgnlValues)
      Converts the specified map to an AttributeMap by calling make(Object, boolean) on each map value. Ognl values are not masked.
      Parameters:
      srcMap - The map to convert.
      maskedKeySet - A set of field names that should have their values masked.
      maskOgnlValues - Whether all the values should be masked.
      Returns:
      A new AttributeMap.
    • setMasked

      public static AttributeMap setMasked(AttributeMap srcMap, Set<String> maskedKeySet, boolean maskOgnlValues)
      Returns a new AttributeMap with each of its AttributeValue updated with the appropriate mask setting.
      Parameters:
      srcMap - The source AttributeMap.
      maskedKeySet - A set of attribute names, whose values should be masked.
      maskOgnlValues - Whether or not the mask the Ognl values.
      Returns:
      A new AttributeMap with the appropriate masked flags.
    • convert

      public static AttributeMap convert(Map<String,Object> srcMap, boolean maskAll, Set<String> maskedKeySet, boolean maskOgnlValues)
    • checkSetMasked

      public static void checkSetMasked(Map<String,AttributeValue> attrMap, Set<String> maskedKeySet)
      Updates the specified AttributeMap by updating each masked flag depending on the maskedKeySet.
      Parameters:
      attrMap - The AttributeMap to be updated.
      maskedKeySet - A set of attribute names, whose values should be masked. For any values not in this set the masked flag is cleared.
    • setMasked

      public static void setMasked(AttributeValue attributeValue)
      Helper method to set the specified attribute value's masked flag to true.
      Parameters:
      attributeValue - The attribute value to mask.