Class: Spid::Saml2::IdpMetadataParser

Inherits:
Object
  • Object
show all
Defined in:
lib/spid/saml2/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

Instance Method Summary collapse

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



23
24
25
# File 'lib/spid/saml2/idp_metadata_parser.rb', line 23

def document
  @document
end

#responseObject (readonly)

Returns the value of attribute response.



24
25
26
# File 'lib/spid/saml2/idp_metadata_parser.rb', line 24

def response
  @response
end

Instance Method Details

#parse_to_hash(idp_metadata) ⇒ Hash

Parse the Identity Provider metadata and return the results as Hash

Parameters:

  • idp_metadata (String)

Returns:

  • (Hash)


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/spid/saml2/idp_metadata_parser.rb', line 31

def parse_to_hash()
  @document = REXML::Document.new()
  @entity_descriptor = nil
  @certificates = nil

  {
    :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_multi => nil
  }.tap do |response_hash|
    merge_certificates_into(response_hash) unless certificates.nil?
  end
end