class Saml::Attributes
- Saml::Attributes
- Reference
- Object
Overview
SAML2 Attributes. Parse the Attributes from the AttributeStatement of the SAML Response.
Included Modules
- Enumerable(Bool | Int32 | String | Nil)
Defined in:
saml/attributes.crConstructors
-
.new(attrs : Hash(String, Array(Bool | Int32 | String | Nil)) = {} of String => Array(AttributeValue))
@param attrs [Hash] The +attrs+ must be a Hash with attribute names as keys and arrays as values: Attributes.new({ 'name' => ['value1', 'value2'], 'mail' => ['value1'], })
Instance Method Summary
-
#==(other)
Make comparable to another Attributes collection based on attributes @param other [Attributes] An Attributes object to compare with @return [Boolean] True if are contains the same attributes and values
-
#[](name)
Retrieve attribute value(s) @param name [String] The attribute name @return [String|Array] Depending on the single value compatibility status this returns: - First value if single_value_compatibility = true response.attributes['mail'] # => '[email protected]' - All values if single_value_compatibility = false response.attributes['mail'] # => ['[email protected]','[email protected]']
- #[]=(name, values)
-
#add(name : String, values = [] of AttributeValue)
@param name [String] The attribute name @param values [Array] The values
-
#all
@return [Hash] Return all attributes as a hash
- #attributes : Hash(String, Array(Bool | Int32 | String | Nil))
-
#each(&) : AttributeValue
Iterate over all attributes
-
#fetch(name)
Fetch attribute value using name or regex @param name [String|Regexp] The attribute name @return [String|Array] Depending on the single value compatibility status this returns: - First value if single_value_compatibility = true response.attributes['mail'] # => '[email protected]' - All values if single_value_compatibility = false response.attributes['mail'] # => ['[email protected]','[email protected]']
-
#includes?(name)
Test attribute presence by name @param name [String] The attribute name to be checked
-
#multi(name)
Return all values for an attribute @param name [String] The attribute name @return [Array] Values of the attribute
-
#set(name, values)
@param name [String] The attribute name @param values [Array] The values
-
#single(name)
Return first value for an attribute @param name [String] The attribute name @return [String] The value (First occurrence)
Constructor Detail
@param attrs [Hash] The +attrs+ must be a Hash with attribute names as keys and arrays as values: Attributes.new({ 'name' => ['value1', 'value2'], 'mail' => ['value1'], })
Instance Method Detail
Make comparable to another Attributes collection based on attributes @param other [Attributes] An Attributes object to compare with @return [Boolean] True if are contains the same attributes and values
Retrieve attribute value(s) @param name [String] The attribute name @return [String|Array] Depending on the single value compatibility status this returns: - First value if single_value_compatibility = true response.attributes['mail'] # => '[email protected]' - All values if single_value_compatibility = false response.attributes['mail'] # => ['[email protected]','[email protected]']
@param name [String] The attribute name @param values [Array] The values
Fetch attribute value using name or regex @param name [String|Regexp] The attribute name @return [String|Array] Depending on the single value compatibility status this returns: - First value if single_value_compatibility = true response.attributes['mail'] # => '[email protected]' - All values if single_value_compatibility = false response.attributes['mail'] # => ['[email protected]','[email protected]']
Test attribute presence by name @param name [String] The attribute name to be checked
Return all values for an attribute @param name [String] The attribute name @return [Array] Values of the attribute
Return first value for an attribute @param name [String] The attribute name @return [String] The value (First occurrence)