Class: SAML2::IdentityProvider

Inherits:
SSO show all
Defined in:
lib/saml2/identity_provider.rb

Instance Attribute Summary collapse

Attributes inherited from SSO

#name_id_formats, #single_logout_services

Attributes inherited from Role

#keys, #supported_protocols

Attributes included from OrganizationAndContacts

#contacts, #organization

Instance Method Summary collapse

Methods inherited from Role

#encryption_keys, #signing_keys

Methods inherited from Base

from_xml, load_object_array, load_string_array, lookup_qname, #to_s, #to_xml

Constructor Details

#initializeIdentityProvider

Returns a new instance of IdentityProvider.



8
9
10
11
12
13
14
# File 'lib/saml2/identity_provider.rb', line 8

def initialize
  super
  @want_authn_requests_signed = nil
  @single_sign_on_services = []
  @attribute_profiles = []
  @attributes = []
end

Instance Attribute Details

#attribute_profilesObject



35
36
37
# File 'lib/saml2/identity_provider.rb', line 35

def attribute_profiles
  @attribute_profiles ||= load_string_array(@root, 'md:AttributeProfile')
end

#attributesObject



39
40
41
# File 'lib/saml2/identity_provider.rb', line 39

def attributes
  @attributes ||= load_object_array(@root, 'saml:Attribute', Attribute)
end

#single_sign_on_servicesObject



31
32
33
# File 'lib/saml2/identity_provider.rb', line 31

def single_sign_on_services
  @single_sign_on_services ||= load_object_array(@root, 'md:SingleSignOnService', Endpoint)
end

#want_authn_requests_signed=(value) ⇒ Object (writeonly)

Sets the attribute want_authn_requests_signed

Parameters:

  • value

    the value to set the attribute want_authn_requests_signed to.



6
7
8
# File 'lib/saml2/identity_provider.rb', line 6

def want_authn_requests_signed=(value)
  @want_authn_requests_signed = value
end

Instance Method Details

#build(builder) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/saml2/identity_provider.rb', line 43

def build(builder)
  builder['md'].IDPSSODescriptor do |builder|
    super(builder)

    builder['WantAuthnRequestsSigned'] = want_authn_requests_signed? unless want_authn_requests_signed?.nil?

    single_sign_on_services.each do |sso|
      sso.build(builder, 'SingleSignOnService')
    end

    attribute_profiles.each do |ap|
      builder['md'].AttributeProfile(ap)
    end

    attributes.each do |attr|
      attr.build(builder)
    end
  end
end

#from_xml(node) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/saml2/identity_provider.rb', line 16

def from_xml(node)
  super
  remove_instance_variable(:@want_authn_requests_signed)
  @single_sign_on_services = nil
  @attribute_profiles = nil
  @attributes = nil
end

#want_authn_requests_signed?Boolean

Returns:

  • (Boolean)


24
25
26
27
28
29
# File 'lib/saml2/identity_provider.rb', line 24

def want_authn_requests_signed?
  unless instance_variable_defined?(:@want_authn_requests_signed)
    @want_authn_requests_signed = @root['WantAuthnRequestsSigned'] && @root['WantAuthnRequestsSigned'] == 'true'
  end
  @want_authn_requests_signed
end