Class: SamlIdpMetadata::Parser
- Inherits:
-
Object
- Object
- SamlIdpMetadata::Parser
- Defined in:
- lib/saml_idp_metadata/parser.rb
Overview
SAML IdP metadata parser
Instance Attribute Summary collapse
-
#entity_id ⇒ Object
readonly
Returns the value of attribute entity_id.
-
#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.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/saml_idp_metadata/parser.rb', line 11 def initialize(xml:) @xml = xml @hash = Hash.from_xml(xml) @xmlns = nil @entity_id = nil @sso_http_redirect_url = nil @sso_http_post_url = nil @slo_url = nil @x509_certificate = nil end |
Instance Attribute Details
#entity_id ⇒ Object (readonly)
Returns the value of attribute entity_id.
9 10 11 |
# File 'lib/saml_idp_metadata/parser.rb', line 9 def entity_id @entity_id end |
#slo_url ⇒ Object (readonly)
Returns the value of attribute slo_url.
9 10 11 |
# File 'lib/saml_idp_metadata/parser.rb', line 9 def slo_url @slo_url end |
#sso_http_post_url ⇒ Object (readonly)
Returns the value of attribute sso_http_post_url.
9 10 11 |
# File 'lib/saml_idp_metadata/parser.rb', line 9 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.
9 10 11 |
# File 'lib/saml_idp_metadata/parser.rb', line 9 def sso_http_redirect_url @sso_http_redirect_url end |
#x509_certificate ⇒ Object (readonly)
Returns the value of attribute x509_certificate.
9 10 11 |
# File 'lib/saml_idp_metadata/parser.rb', line 9 def x509_certificate @x509_certificate end |
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
9 10 11 |
# File 'lib/saml_idp_metadata/parser.rb', line 9 def xml @xml end |
#xmlns ⇒ Object (readonly)
Returns the value of attribute xmlns.
9 10 11 |
# File 'lib/saml_idp_metadata/parser.rb', line 9 def xmlns @xmlns end |
Class Method Details
.call(xml:) ⇒ Object
23 24 25 |
# File 'lib/saml_idp_metadata/parser.rb', line 23 def self.call(xml:) new(xml: xml).call end |
Instance Method Details
#build_params ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/saml_idp_metadata/parser.rb', line 47 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, metadata: xml } end |
#call ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/saml_idp_metadata/parser.rb', line 27 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 @slo_url = parse_slo_url @x509_certificate = parse_x509_certificate self end |
#ensure_params? ⇒ Boolean
43 44 45 |
# File 'lib/saml_idp_metadata/parser.rb', line 43 def ensure_params? entity_id.present? && (sso_http_redirect_url.present? && sso_http_post_url.present?) && x509_certificate.present? end |
#validate_xmlns ⇒ Object
39 40 41 |
# File 'lib/saml_idp_metadata/parser.rb', line 39 def validate_xmlns xmlns == 'urn:oasis:names:tc:SAML:2.0:metadata' end |