Class: OneLogin::RubySaml::SloLogoutrequest
- Inherits:
-
SamlMessage
- Object
- SamlMessage
- OneLogin::RubySaml::SloLogoutrequest
- Includes:
- ErrorHandling
- Defined in:
- lib/onelogin/ruby-saml/slo_logoutrequest.rb
Overview
SAML2 Logout Request (SLO IdP initiated, Parser)
Constant Summary
Constants inherited from SamlMessage
OneLogin::RubySaml::SamlMessage::ASSERTION, OneLogin::RubySaml::SamlMessage::BASE64_FORMAT, OneLogin::RubySaml::SamlMessage::PROTOCOL
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#settings ⇒ Object
OneLogin::RubySaml::Settings Toolkit settings.
-
#soft ⇒ Object
Returns the value of attribute soft.
Attributes included from ErrorHandling
Instance Method Summary collapse
-
#id ⇒ String|nil
Gets the ID attribute from the Logout Request.
-
#initialize(request, options = {}) ⇒ SloLogoutrequest
constructor
Constructs the Logout Request.
-
#is_valid?(collect_errors = false) ⇒ Boolean
Validates the Logout Request with the default values (soft = true).
-
#issuer ⇒ String
Gets the Issuer from the Logout Request.
-
#name_id ⇒ String
(also: #nameid)
Gets the NameID of the Logout Request.
-
#name_id_format ⇒ String
(also: #nameid_format)
Gets the NameID Format of the Logout Request.
-
#not_on_or_after ⇒ Time|nil
Gets the NotOnOrAfter Attribute value if exists.
-
#session_indexes ⇒ Array
Gets the SessionIndex if exists (Supported multiple values).
Methods included from ErrorHandling
Methods inherited from SamlMessage
schema, #valid_saml?, #version
Constructor Details
#initialize(request, options = {}) ⇒ SloLogoutrequest
Constructs the Logout Request. A Logout Request Object that is an extension of the SamlMessage class.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 33 def initialize(request, = {}) raise ArgumentError.new("Request cannot be nil") if request.nil? @errors = [] @options = @soft = true unless [:settings].nil? @settings = [:settings] unless @settings.soft.nil? @soft = @settings.soft end end @request = decode_raw_saml(request) @document = REXML::Document.new(@request) end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
19 20 21 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 19 def document @document end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
21 22 23 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 21 def @options end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
20 21 22 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 20 def request @request end |
#settings ⇒ Object
OneLogin::RubySaml::Settings Toolkit settings
17 18 19 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 17 def settings @settings end |
#soft ⇒ Object
Returns the value of attribute soft.
23 24 25 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 23 def soft @soft end |
Instance Method Details
#id ⇒ String|nil
Returns Gets the ID attribute from the Logout Request. if exists.
83 84 85 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 83 def id super(document) end |
#is_valid?(collect_errors = false) ⇒ Boolean
Validates the Logout Request with the default values (soft = true)
54 55 56 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 54 def is_valid?(collect_errors = false) validate(collect_errors) end |
#issuer ⇒ String
Returns Gets the Issuer from the Logout Request.
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 89 def issuer @issuer ||= begin node = REXML::XPath.first( document, "/p:LogoutRequest/a:Issuer", { "p" => PROTOCOL, "a" => ASSERTION } ) Utils.element_text(node) end end |
#name_id ⇒ String Also known as: nameid
Returns Gets the NameID of the Logout Request.
60 61 62 63 64 65 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 60 def name_id @name_id ||= begin node = REXML::XPath.first(document, "/p:LogoutRequest/a:NameID", { "p" => PROTOCOL, "a" => ASSERTION }) Utils.element_text(node) end end |
#name_id_format ⇒ String Also known as: nameid_format
Returns Gets the NameID Format of the Logout Request.
71 72 73 74 75 76 77 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 71 def name_id_format @name_id_node ||= REXML::XPath.first(document, "/p:LogoutRequest/a:NameID", { "p" => PROTOCOL, "a" => ASSERTION }) @name_id_format ||= if @name_id_node && @name_id_node.attribute("Format") @name_id_node.attribute("Format").value end end |
#not_on_or_after ⇒ Time|nil
Returns Gets the NotOnOrAfter Attribute value if exists.
102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 102 def not_on_or_after @not_on_or_after ||= begin node = REXML::XPath.first( document, "/p:LogoutRequest", { "p" => PROTOCOL } ) if node && node.attributes["NotOnOrAfter"] Time.parse(node.attributes["NotOnOrAfter"]) end end end |
#session_indexes ⇒ Array
Returns Gets the SessionIndex if exists (Supported multiple values). Empty Array if none found.
117 118 119 120 121 122 123 124 125 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 117 def session_indexes nodes = REXML::XPath.match( document, "/p:LogoutRequest/p:SessionIndex", { "p" => PROTOCOL } ) nodes.map { |node| Utils.element_text(node) } end |