class Saml::Attributes

Overview

SAML2 Attributes. Parse the Attributes from the AttributeStatement of the SAML Response.

Included Modules

Defined in:

saml/attributes.cr

Constructors

Instance Method Summary

Constructor Detail

def self.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'], })


[View source]

Instance Method Detail

def ==(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


[View source]
def [](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]']


[View source]
def []=(name, values) #

[View source]
def add(name : String, values = [] of AttributeValue) #

@param name [String] The attribute name @param values [Array] The values


[View source]
def all #

@return [Hash] Return all attributes as a hash


[View source]
def attributes : Hash(String, Array(Bool | Int32 | String | Nil)) #

[View source]
def each(&) : AttributeValue #

Iterate over all attributes


[View source]
def 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]']


[View source]
def includes?(name) #

Test attribute presence by name @param name [String] The attribute name to be checked


[View source]
def multi(name) #

Return all values for an attribute @param name [String] The attribute name @return [Array] Values of the attribute


[View source]
def set(name, values) #

@param name [String] The attribute name @param values [Array] The values


[View source]
def single(name) #

Return first value for an attribute @param name [String] The attribute name @return [String] The value (First occurrence)


[View source]