Class: SamlIdp::NameIdFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/saml_idp/name_id_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(list) ⇒ NameIdFormatter

Returns a new instance of NameIdFormatter.



4
5
6
# File 'lib/saml_idp/name_id_formatter.rb', line 4

def initialize(list)
  self.list = (list || {})
end

Instance Attribute Details

#listObject

Returns the value of attribute list.



3
4
5
# File 'lib/saml_idp/name_id_formatter.rb', line 3

def list
  @list
end

Instance Method Details

#allObject



8
9
10
11
12
13
14
15
# File 'lib/saml_idp/name_id_formatter.rb', line 8

def all
  if split?
    one_one.map { |key_val| build("1.1", key_val)[:name] } +
    two_zero.map { |key_val| build("2.0", key_val)[:name] }
  else
    list.map { |key_val| build("2.0", key_val)[:name] }
  end
end

#chosenObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/saml_idp/name_id_formatter.rb', line 17

def chosen
  if split?
    version, choose = "1.1", one_one.first
    version, choose = "2.0", two_zero.first unless choose
    version, choose = "2.0", "persistent" unless choose
    build(version, choose)
  else
    choose = list.first || "persistent"
    build("2.0", choose)
  end
end