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::MAX_BYTE_SIZE, 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.
- #request_id ⇒ Object
-
#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.
87 88 89 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 87 def id super(document) end |
#is_valid?(collect_errors = false) ⇒ Boolean
Validates the Logout Request with the default values (soft = true)
58 59 60 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 58 def is_valid?(collect_errors = false) validate(collect_errors) end |
#issuer ⇒ String
Returns Gets the Issuer from the Logout Request.
93 94 95 96 97 98 99 100 101 102 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 93 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.
64 65 66 67 68 69 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 64 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.
75 76 77 78 79 80 81 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 75 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.
106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 106 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 |
#request_id ⇒ Object
50 51 52 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 50 def request_id id(document) end |
#session_indexes ⇒ Array
Returns Gets the SessionIndex if exists (Supported multiple values). Empty Array if none found.
121 122 123 124 125 126 127 128 129 |
# File 'lib/onelogin/ruby-saml/slo_logoutrequest.rb', line 121 def session_indexes nodes = REXML::XPath.match( document, "/p:LogoutRequest/p:SessionIndex", { "p" => PROTOCOL } ) nodes.map { |node| Utils.element_text(node) } end |