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.
-
#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.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/saml_idp_metadata/parser.rb', line 14 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 @nameid_format = nil @x509_certificate = nil end |
Instance Attribute Details
#entity_id ⇒ Object (readonly)
Returns the value of attribute entity_id.
11 12 13 |
# File 'lib/saml_idp_metadata/parser.rb', line 11 def entity_id @entity_id end |
#nameid_format ⇒ Object (readonly)
Returns the value of attribute nameid_format.
11 12 13 |
# File 'lib/saml_idp_metadata/parser.rb', line 11 def nameid_format @nameid_format end |
#slo_url ⇒ Object (readonly)
Returns the value of attribute slo_url.
11 12 13 |
# File 'lib/saml_idp_metadata/parser.rb', line 11 def slo_url @slo_url end |
#sso_http_post_url ⇒ Object (readonly)
Returns the value of attribute sso_http_post_url.
11 12 13 |
# File 'lib/saml_idp_metadata/parser.rb', line 11 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.
11 12 13 |
# File 'lib/saml_idp_metadata/parser.rb', line 11 def sso_http_redirect_url @sso_http_redirect_url end |
#x509_certificate ⇒ Object (readonly)
Returns the value of attribute x509_certificate.
11 12 13 |
# File 'lib/saml_idp_metadata/parser.rb', line 11 def x509_certificate @x509_certificate end |
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
11 12 13 |
# File 'lib/saml_idp_metadata/parser.rb', line 11 def xml @xml end |
#xmlns ⇒ Object (readonly)
Returns the value of attribute xmlns.
11 12 13 |
# File 'lib/saml_idp_metadata/parser.rb', line 11 def xmlns @xmlns end |
Class Method Details
.call(xml:) ⇒ Object
27 28 29 |
# File 'lib/saml_idp_metadata/parser.rb', line 27 def self.call(xml:) new(xml: xml).call end |
Instance Method Details
#build_params ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/saml_idp_metadata/parser.rb', line 52 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
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/saml_idp_metadata/parser.rb', line 31 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 @nameid_format = parse_nameid_format @x509_certificate = parse_x509_certificate self end |
#ensure_params? ⇒ Boolean
48 49 50 |
# File 'lib/saml_idp_metadata/parser.rb', line 48 def ensure_params? entity_id.present? && (sso_http_redirect_url.present? && sso_http_post_url.present?) && x509_certificate.present? end |
#validate_xmlns ⇒ Object
44 45 46 |
# File 'lib/saml_idp_metadata/parser.rb', line 44 def validate_xmlns xmlns == 'urn:oasis:names:tc:SAML:2.0:metadata' end |