Class: SAML2::ServiceProvider
- Defined in:
- lib/saml2/service_provider.rb
Instance Attribute Summary collapse
-
#authn_requests_signed ⇒ Object
writeonly
Sets the attribute authn_requests_signed.
-
#want_assertions_signed ⇒ Object
writeonly
Sets the attribute want_assertions_signed.
Attributes inherited from Role
#fingerprints, #keys, #private_keys, #supported_protocols
Attributes included from OrganizationAndContacts
Attributes inherited from Base
Instance Method Summary collapse
- #assertion_consumer_services ⇒ Endpoint::Indexed::Array
- #attribute_consuming_services ⇒ AttributeConsumingService::Array
- #authn_requests_signed? ⇒ Boolean?
-
#build(builder) ⇒ void
Serialize this object to XML, as part of a larger document.
-
#from_xml(node) ⇒ void
Parse an XML element into this object.
-
#initialize ⇒ ServiceProvider
constructor
A new instance of ServiceProvider.
- #want_assertions_signed? ⇒ Boolean?
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
#initialize ⇒ ServiceProvider
Returns a new instance of ServiceProvider.
12 13 14 15 16 17 18 |
# File 'lib/saml2/service_provider.rb', line 12 def initialize super @authn_requests_signed = nil @want_assertions_signed = nil @assertion_consumer_services = Endpoint::Indexed::Array.new @attribute_consuming_services = AttributeConsumingService::Array.new end |
Instance Attribute Details
#authn_requests_signed=(value) ⇒ Object (writeonly)
Sets the attribute authn_requests_signed
10 11 12 |
# File 'lib/saml2/service_provider.rb', line 10 def authn_requests_signed=(value) @authn_requests_signed = value end |
#want_assertions_signed=(value) ⇒ Object (writeonly)
Sets the attribute want_assertions_signed
10 11 12 |
# File 'lib/saml2/service_provider.rb', line 10 def want_assertions_signed=(value) @want_assertions_signed = value end |
Instance Method Details
#assertion_consumer_services ⇒ Endpoint::Indexed::Array
46 47 48 49 50 51 |
# File 'lib/saml2/service_provider.rb', line 46 def assertion_consumer_services @assertion_consumer_services ||= begin nodes = xml.xpath("md:AssertionConsumerService", Namespaces::ALL) Endpoint::Indexed::Array.from_xml(nodes) end end |
#attribute_consuming_services ⇒ AttributeConsumingService::Array
54 55 56 57 58 59 |
# File 'lib/saml2/service_provider.rb', line 54 def attribute_consuming_services @attribute_consuming_services ||= begin nodes = xml.xpath("md:AttributeConsumingService", Namespaces::ALL) AttributeConsumingService::Array.from_xml(nodes) end end |
#authn_requests_signed? ⇒ Boolean?
30 31 32 33 34 35 |
# File 'lib/saml2/service_provider.rb', line 30 def authn_requests_signed? unless instance_variable_defined?(:@authn_requests_signed) @authn_requests_signed = xml["AuthnRequestsSigned"] && xml["AuthnRequestsSigned"] == "true" end @authn_requests_signed end |
#build(builder) ⇒ void
This method returns an undefined value.
Serialize this object to XML, as part of a larger document
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/saml2/service_provider.rb', line 62 def build(builder) builder["md"].SPSSODescriptor do |sp_sso_descriptor| super(sp_sso_descriptor) sp_sso_descriptor.parent["AuthnRequestsSigned"] = authn_requests_signed? unless authn_requests_signed?.nil? sp_sso_descriptor.parent["WantAssertionsSigned"] = want_assertions_signed? unless want_assertions_signed?.nil? assertion_consumer_services.each do |acs| acs.build(sp_sso_descriptor, "AssertionConsumerService") end attribute_consuming_services.each do |acs| acs.build(sp_sso_descriptor) end end end |
#from_xml(node) ⇒ void
This method returns an undefined value.
Parse an XML element into this object.
21 22 23 24 25 26 27 |
# File 'lib/saml2/service_provider.rb', line 21 def from_xml(node) super remove_instance_variable(:@authn_requests_signed) remove_instance_variable(:@want_assertions_signed) @assertion_consumer_services = nil @attribute_consuming_services = nil end |
#want_assertions_signed? ⇒ Boolean?
38 39 40 41 42 43 |
# File 'lib/saml2/service_provider.rb', line 38 def want_assertions_signed? unless instance_variable_defined?(:@want_assertions_signed) @want_assertions_signed = xml["WantAssertionsSigned"] && xml["WantAssertionsSigned"] == "true" end @want_assertions_signed end |