Class: SamlAuthenticatable::SamlMappedAttributes

Inherits:
Object
  • Object
show all
Defined in:
lib/devise_saml_authenticatable/saml_mapped_attributes.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes, attribute_map) ⇒ SamlMappedAttributes

Returns a new instance of SamlMappedAttributes.



3
4
5
6
7
# File 'lib/devise_saml_authenticatable/saml_mapped_attributes.rb', line 3

def initialize(attributes, attribute_map)
  @attributes = attributes
  @attribute_map = attribute_map
  @inverted_attribute_map = @attribute_map.invert
end

Instance Method Details

#resource_keysObject



13
14
15
# File 'lib/devise_saml_authenticatable/saml_mapped_attributes.rb', line 13

def resource_keys
  @attribute_map.values
end

#saml_attribute_keysObject



9
10
11
# File 'lib/devise_saml_authenticatable/saml_mapped_attributes.rb', line 9

def saml_attribute_keys
  @attribute_map.keys
end

#value_by_resource_key(key) ⇒ Object



17
18
19
# File 'lib/devise_saml_authenticatable/saml_mapped_attributes.rb', line 17

def value_by_resource_key(key)
  value_by_saml_attribute_key(@inverted_attribute_map.fetch(String(key)))
end

#value_by_saml_attribute_key(key) ⇒ Object



21
22
23
# File 'lib/devise_saml_authenticatable/saml_mapped_attributes.rb', line 21

def value_by_saml_attribute_key(key)
  @attributes[String(key)]
end