Class: SAML2::IdentityProvider

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

Instance Attribute Summary collapse

Attributes inherited from Role

#fingerprints, #keys, #private_keys, #supported_protocols

Attributes included from OrganizationAndContacts

#contacts, #organization

Attributes inherited from Base

#xml

Instance Method Summary collapse

Methods inherited from SSO

#name_id_formats, #single_logout_services

Methods inherited from Role

#encryption_keys, #signing_keys

Methods included from Signable

#sign, #signature, #signed?, #signing_key, #valid_signature?, #validate_signature

Methods inherited from Base

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

Constructor Details

#initializeIdentityProvider

Returns a new instance of IdentityProvider.



12
13
14
15
16
17
18
# File 'lib/saml2/identity_provider.rb', line 12

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

Instance Attribute Details

#attribute_profilesArray<String>

Returns:

  • (Array<String>)


43
44
45
# File 'lib/saml2/identity_provider.rb', line 43

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

#attributesArray<Attribute>

Returns:



48
49
50
# File 'lib/saml2/identity_provider.rb', line 48

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

#single_sign_on_servicesArray<Endpoint>

Returns:



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

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

#want_authn_requests_signed=(value) ⇒ Boolean? (writeonly)

Returns:

  • (Boolean, nil)


9
10
11
# File 'lib/saml2/identity_provider.rb', line 9

def want_authn_requests_signed=(value)
  @want_authn_requests_signed = value
end

Instance Method Details

#build(builder) ⇒ void

This method returns an undefined value.

Serialize this object to XML, as part of a larger document

Parameters:

  • builder (Nokogiri::XML::Builder)

    The builder helper object to serialize to.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/saml2/identity_provider.rb', line 53

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

    idp_sso_descriptor.parent['WantAuthnRequestsSigned'] = want_authn_requests_signed? unless want_authn_requests_signed?.nil?

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

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

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

#from_xml(node) ⇒ void

This method returns an undefined value.

Parse an XML element into this object.

Parameters:

  • node (Nokogiri::XML::Element)


21
22
23
24
25
26
27
# File 'lib/saml2/identity_provider.rb', line 21

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, nil)


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

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