Class: SamlIdpMetadata::Parser
- Inherits:
-
Object
- Object
- SamlIdpMetadata::Parser
- Defined in:
- lib/saml_idp_metadata/parser.rb
Overview
SAML IdP metadata parser with REXML
Instance Attribute Summary collapse
-
#entity_id ⇒ Object
readonly
Returns the value of attribute entity_id.
-
#nameid_format ⇒ Object
readonly
Returns the value of attribute nameid_format.
-
#slo_url ⇒ Object
readonly
Returns the value of attribute slo_url.
-
#sso_http_post_url ⇒ Object
readonly
Returns the value of attribute sso_http_post_url.
-
#sso_http_redirect_url ⇒ Object
readonly
Returns the value of attribute sso_http_redirect_url.
-
#x509_certificate ⇒ Object
readonly
Returns the value of attribute x509_certificate.
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
-
#xmlns ⇒ Object
readonly
Returns the value of attribute xmlns.
Class Method Summary collapse
Instance Method Summary collapse
- #build_params ⇒ Object
- #call ⇒ Object
- #ensure_params? ⇒ Boolean
-
#initialize(xml:) ⇒ Parser
constructor
A new instance of Parser.
- #validate_xmlns ⇒ Object
Constructor Details
#initialize(xml:) ⇒ Parser
Returns a new instance of Parser.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/saml_idp_metadata/parser.rb', line 13 def initialize(xml:) @xml = xml @doc = REXML::Document.new(xml) @xmlns = nil @entity_id = nil @sso_http_redirect_url = nil @sso_http_post_url = nil @slo_url = nil @nameid_format = nil @x509_certificate = nil end |
Instance Attribute Details
#entity_id ⇒ Object (readonly)
Returns the value of attribute entity_id.
10 11 12 |
# File 'lib/saml_idp_metadata/parser.rb', line 10 def entity_id @entity_id end |
#nameid_format ⇒ Object (readonly)
Returns the value of attribute nameid_format.
10 11 12 |
# File 'lib/saml_idp_metadata/parser.rb', line 10 def nameid_format @nameid_format end |
#slo_url ⇒ Object (readonly)
Returns the value of attribute slo_url.
10 11 12 |
# File 'lib/saml_idp_metadata/parser.rb', line 10 def slo_url @slo_url end |
#sso_http_post_url ⇒ Object (readonly)
Returns the value of attribute sso_http_post_url.
10 11 12 |
# File 'lib/saml_idp_metadata/parser.rb', line 10 def sso_http_post_url @sso_http_post_url end |
#sso_http_redirect_url ⇒ Object (readonly)
Returns the value of attribute sso_http_redirect_url.
10 11 12 |
# File 'lib/saml_idp_metadata/parser.rb', line 10 def sso_http_redirect_url @sso_http_redirect_url end |
#x509_certificate ⇒ Object (readonly)
Returns the value of attribute x509_certificate.
10 11 12 |
# File 'lib/saml_idp_metadata/parser.rb', line 10 def x509_certificate @x509_certificate end |
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
10 11 12 |
# File 'lib/saml_idp_metadata/parser.rb', line 10 def xml @xml end |
#xmlns ⇒ Object (readonly)
Returns the value of attribute xmlns.
10 11 12 |
# File 'lib/saml_idp_metadata/parser.rb', line 10 def xmlns @xmlns end |
Class Method Details
.call(xml:) ⇒ Object
26 27 28 |
# File 'lib/saml_idp_metadata/parser.rb', line 26 def self.call(xml:) new(xml: xml).call end |
Instance Method Details
#build_params ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/saml_idp_metadata/parser.rb', line 50 def build_params { entity_id: entity_id, sso_http_redirect_url: sso_http_redirect_url, sso_http_post_url: sso_http_post_url, certificate: x509_certificate, slo_url: slo_url, nameid_format: nameid_format, metadata: xml } end |
#call ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/saml_idp_metadata/parser.rb', line 30 def call @xmlns = parse_xmlns @entity_id = parse_entity_id @sso_http_redirect_url = parse_sso_http_redirect_url @sso_http_post_url = parse_sso_http_post_url || parse_sso_http_redirect_url @slo_url = parse_slo_url @nameid_format = parse_nameid_format @x509_certificate = parse_x509_certificate self end |
#ensure_params? ⇒ Boolean
46 47 48 |
# File 'lib/saml_idp_metadata/parser.rb', line 46 def ensure_params? present?(entity_id) && present?(sso_http_redirect_url) && present?(sso_http_post_url) && present?(x509_certificate) end |
#validate_xmlns ⇒ Object
42 43 44 |
# File 'lib/saml_idp_metadata/parser.rb', line 42 def validate_xmlns xmlns == 'urn:oasis:names:tc:SAML:2.0:metadata' end |