Class: OneLogin::RubySaml::IdpMetadataParser
- Inherits:
-
Object
- Object
- OneLogin::RubySaml::IdpMetadataParser
- Defined in:
- lib/onelogin/ruby-saml/idp_metadata_parser.rb
Overview
Auxiliary class to retrieve and parse the Identity Provider Metadata
Constant Summary collapse
- METADATA =
"urn:oasis:names:tc:SAML:2.0:metadata"
- DSIG =
"http://www.w3.org/2000/09/xmldsig#"
- NAME_FORMAT =
"urn:oasis:names:tc:SAML:2.0:attrname-format:*"
- SAML_ASSERTION =
"urn:oasis:names:tc:SAML:2.0:assertion"
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#parse(idp_metadata, options = {}) ⇒ OneLogin::RubySaml::Settings
Parse the Identity Provider metadata and update the settings with the IdP values.
-
#parse_remote(url, validate_cert = true, options = {}) ⇒ OneLogin::RubySaml::Settings
Parse the Identity Provider metadata and update the settings with the IdP values.
-
#parse_remote_to_hash(url, validate_cert = true, options = {}) ⇒ Hash
Parse the Identity Provider metadata and return the results as Hash.
-
#parse_to_hash(idp_metadata, options = {}) ⇒ Hash
Parse the Identity Provider metadata and return the results as Hash.
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
23 24 25 |
# File 'lib/onelogin/ruby-saml/idp_metadata_parser.rb', line 23 def document @document end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
25 26 27 |
# File 'lib/onelogin/ruby-saml/idp_metadata_parser.rb', line 25 def @options end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
24 25 26 |
# File 'lib/onelogin/ruby-saml/idp_metadata_parser.rb', line 24 def response @response end |
Instance Method Details
#parse(idp_metadata, options = {}) ⇒ OneLogin::RubySaml::Settings
Parse the Identity Provider metadata and update the settings with the IdP values
76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/onelogin/ruby-saml/idp_metadata_parser.rb', line 76 def parse(, = {}) = parse_to_hash(, ) settings = [:settings] if settings.nil? OneLogin::RubySaml::Settings.new() elsif settings.is_a?(Hash) OneLogin::RubySaml::Settings.new(settings.merge()) else (settings, ) end end |
#parse_remote(url, validate_cert = true, options = {}) ⇒ OneLogin::RubySaml::Settings
Parse the Identity Provider metadata and update the settings with the IdP values
42 43 44 45 |
# File 'lib/onelogin/ruby-saml/idp_metadata_parser.rb', line 42 def parse_remote(url, validate_cert = true, = {}) = (url, validate_cert) parse(, ) end |
#parse_remote_to_hash(url, validate_cert = true, options = {}) ⇒ Hash
Parse the Identity Provider metadata and return the results as Hash
60 61 62 63 |
# File 'lib/onelogin/ruby-saml/idp_metadata_parser.rb', line 60 def parse_remote_to_hash(url, validate_cert = true, = {}) = (url, validate_cert) parse_to_hash(, ) end |
#parse_to_hash(idp_metadata, options = {}) ⇒ Hash
Parse the Identity Provider metadata and return the results as Hash
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/onelogin/ruby-saml/idp_metadata_parser.rb', line 100 def parse_to_hash(, = {}) @document = REXML::Document.new() @options = @entity_descriptor = nil if idpsso_descriptor.nil? raise ArgumentError.new("idp_metadata must contain an IDPSSODescriptor element") end { :idp_entity_id => idp_entity_id, :name_identifier_format => idp_name_id_format, :idp_sso_target_url => single_signon_service_url(), :idp_slo_target_url => single_logout_service_url(), :idp_attribute_names => attribute_names, :idp_cert => nil, :idp_cert_fingerprint => nil, :idp_cert_multi => nil }.tap do |response_hash| merge_certificates_into(response_hash) unless certificates.nil? end end |