Class: OneLogin::KlRubySaml::IdpMetadataParser

Inherits:
Object
  • Object
show all
Defined in:
lib/onelogin/kl-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#"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



22
23
24
# File 'lib/onelogin/kl-ruby-saml/idp_metadata_parser.rb', line 22

def document
  @document
end

#responseObject (readonly)

Returns the value of attribute response.



23
24
25
# File 'lib/onelogin/kl-ruby-saml/idp_metadata_parser.rb', line 23

def response
  @response
end

Instance Method Details

#parse(idp_metadata) ⇒ Object

Parse the Identity Provider metadata and update the settings with the IdP values

Parameters:

  • idp_metadata (String)


39
40
41
42
43
44
45
46
47
48
49
# File 'lib/onelogin/kl-ruby-saml/idp_metadata_parser.rb', line 39

def parse()
  @document = REXML::Document.new()

  OneLogin::KlRubySaml::Settings.new.tap do |settings|
    settings.idp_entity_id = idp_entity_id
    settings.name_identifier_format = idp_name_id_format
    settings.idp_sso_target_url = single_signon_service_url
    settings.idp_slo_target_url = single_logout_service_url
    settings.idp_cert_fingerprint = fingerprint
  end
end

#parse_remote(url, validate_cert = true) ⇒ REXML::document

Parse the Identity Provider metadata and update the settings with the IdP values

Parameters:

  • url (String)

    Url where the XML of the Identity Provider Metadata is published.

  • validate_cert (Boolean) (defaults to: true)

    If true and the URL is HTTPs, the cert of the domain is checked.

Returns:

  • (REXML::document)

    Parsed XML IdP metadata

Raises:

  • (HttpError)

    Failure to fetch remote IdP metadata



31
32
33
34
# File 'lib/onelogin/kl-ruby-saml/idp_metadata_parser.rb', line 31

def parse_remote(url, validate_cert = true)
   = (url, validate_cert)
  parse()
end