Class: Spid::Saml2::IdpLogoutResponse
- Inherits:
-
Object
- Object
- Spid::Saml2::IdpLogoutResponse
- Defined in:
- lib/spid/saml2/idp_logout_response.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#issue_instant ⇒ Object
readonly
Returns the value of attribute issue_instant.
-
#request_uuid ⇒ Object
readonly
Returns the value of attribute request_uuid.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Instance Method Summary collapse
-
#initialize(settings:, request_uuid:, uuid: nil) ⇒ IdpLogoutResponse
constructor
A new instance of IdpLogoutResponse.
- #issuer ⇒ Object
- #logout_response ⇒ Object
- #logout_response_attributes ⇒ Object
- #status ⇒ Object
- #status_code ⇒ Object
- #to_saml ⇒ Object
Constructor Details
#initialize(settings:, request_uuid:, uuid: nil) ⇒ IdpLogoutResponse
Returns a new instance of IdpLogoutResponse.
12 13 14 15 16 17 18 |
# File 'lib/spid/saml2/idp_logout_response.rb', line 12 def initialize(settings:, request_uuid:, uuid: nil) @document = REXML::Document.new @settings = settings @uuid = uuid || SecureRandom.uuid @issue_instant = Time.now.utc.iso8601 @request_uuid = request_uuid end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
6 7 8 |
# File 'lib/spid/saml2/idp_logout_response.rb', line 6 def document @document end |
#issue_instant ⇒ Object (readonly)
Returns the value of attribute issue_instant.
9 10 11 |
# File 'lib/spid/saml2/idp_logout_response.rb', line 9 def issue_instant @issue_instant end |
#request_uuid ⇒ Object (readonly)
Returns the value of attribute request_uuid.
10 11 12 |
# File 'lib/spid/saml2/idp_logout_response.rb', line 10 def request_uuid @request_uuid end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
7 8 9 |
# File 'lib/spid/saml2/idp_logout_response.rb', line 7 def settings @settings end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
8 9 10 |
# File 'lib/spid/saml2/idp_logout_response.rb', line 8 def uuid @uuid end |
Instance Method Details
#issuer ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/spid/saml2/idp_logout_response.rb', line 47 def issuer @issuer ||= begin element = REXML::Element.new("saml:Issuer") element.add_attributes( "Format" => "urn:oasis:names:tc:SAML:2.0:nameid-format:entity", "NameQualifier" => settings.sp_entity_id ) element.text = settings.sp_entity_id element end end |
#logout_response ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/spid/saml2/idp_logout_response.rb', line 25 def logout_response @logout_response ||= begin element = REXML::Element.new("samlp:LogoutResponse") element.add_attributes(logout_response_attributes) element.add_element(issuer) element.add_element(status) element end end |
#logout_response_attributes ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/spid/saml2/idp_logout_response.rb', line 36 def logout_response_attributes @logout_response_attributes ||= { "xmlns:samlp" => "urn:oasis:names:tc:SAML:2.0:protocol", "xmlns:saml" => "urn:oasis:names:tc:SAML:2.0:assertion", "IssueInstant" => issue_instant, "InResponseTo" => request_uuid, "Destination" => settings.idp_slo_target_url, "ID" => "_#{uuid}" } end |
#status ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'lib/spid/saml2/idp_logout_response.rb', line 60 def status @status ||= begin element = REXML::Element.new("saml:Status") element.add_element(status_code) element end end |
#status_code ⇒ Object
69 70 71 72 73 74 75 76 |
# File 'lib/spid/saml2/idp_logout_response.rb', line 69 def status_code @status_code ||= begin element = REXML::Element.new("saml:StatusCode") element.text = "urn:oasis:names:tc:SAML:2.0:status:Success" element end end |
#to_saml ⇒ Object
20 21 22 23 |
# File 'lib/spid/saml2/idp_logout_response.rb', line 20 def to_saml document.add_element(logout_response) document.to_s end |