Class: OneLogin::KlRubySaml::SloLogoutrequest
- Inherits:
-
SamlMessage
- Object
- SamlMessage
- OneLogin::KlRubySaml::SloLogoutrequest
- Defined in:
- lib/onelogin/kl-ruby-saml/slo_logoutrequest.rb
Overview
SAML2 Logout Request (SLO IdP initiated, Parser)
Constant Summary
Constants inherited from SamlMessage
OneLogin::KlRubySaml::SamlMessage::ASSERTION, OneLogin::KlRubySaml::SamlMessage::BASE64_FORMAT, OneLogin::KlRubySaml::SamlMessage::PROTOCOL
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#errors ⇒ Object
Array with the causes [Array of strings].
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#settings ⇒ Object
OneLogin::KlRubySaml::Settings Toolkit settings.
-
#soft ⇒ Object
Returns the value of attribute soft.
Instance Method Summary collapse
-
#append_error(error_msg) ⇒ Object
Append the cause to the errors array, and based on the value of soft, return false or raise an exception.
-
#id ⇒ String|nil
Gets the ID attribute from the Logout Request.
-
#initialize(request, options = {}) ⇒ SloLogoutrequest
constructor
Constructs the Logout Request.
-
#is_valid? ⇒ 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.
-
#not_on_or_after ⇒ Time|nil
Gets the NotOnOrAfter Attribute value if exists.
-
#reset_errors! ⇒ Object
Reset the errors array.
-
#session_indexes ⇒ Array
Gets the SessionIndex if exists (Supported multiple values).
Methods inherited from SamlMessage
schema, #valid_saml?, #validation_error, #version
Constructor Details
#initialize(request, options = {}) ⇒ SloLogoutrequest
Constructs the Logout Request. A Logout Request Object that is an extension of the SamlMessage class.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/onelogin/kl-ruby-saml/slo_logoutrequest.rb', line 34 def initialize(request, = {}) @errors = [] raise ArgumentError.new("Request cannot be nil") if request.nil? @options = @soft = true if !.empty? && ![:settings].nil? @settings = [:settings] if ![: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.
21 22 23 |
# File 'lib/onelogin/kl-ruby-saml/slo_logoutrequest.rb', line 21 def document @document end |
#errors ⇒ Object
Array with the causes [Array of strings]
19 20 21 |
# File 'lib/onelogin/kl-ruby-saml/slo_logoutrequest.rb', line 19 def errors @errors end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
23 24 25 |
# File 'lib/onelogin/kl-ruby-saml/slo_logoutrequest.rb', line 23 def @options end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
22 23 24 |
# File 'lib/onelogin/kl-ruby-saml/slo_logoutrequest.rb', line 22 def request @request end |
#settings ⇒ Object
OneLogin::KlRubySaml::Settings Toolkit settings
16 17 18 |
# File 'lib/onelogin/kl-ruby-saml/slo_logoutrequest.rb', line 16 def settings @settings end |
#soft ⇒ Object
Returns the value of attribute soft.
25 26 27 |
# File 'lib/onelogin/kl-ruby-saml/slo_logoutrequest.rb', line 25 def soft @soft end |
Instance Method Details
#append_error(error_msg) ⇒ Object
Append the cause to the errors array, and based on the value of soft, return false or raise an exception
53 54 55 56 |
# File 'lib/onelogin/kl-ruby-saml/slo_logoutrequest.rb', line 53 def append_error(error_msg) @errors << error_msg return soft ? false : validation_error(error_msg) end |
#id ⇒ String|nil
Returns Gets the ID attribute from the Logout Request. if exists.
83 84 85 |
# File 'lib/onelogin/kl-ruby-saml/slo_logoutrequest.rb', line 83 def id super(document) end |
#is_valid? ⇒ Boolean
Validates the Logout Request with the default values (soft = true)
66 67 68 |
# File 'lib/onelogin/kl-ruby-saml/slo_logoutrequest.rb', line 66 def is_valid? validate end |
#issuer ⇒ String
Returns Gets the Issuer from the Logout Request.
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/onelogin/kl-ruby-saml/slo_logoutrequest.rb', line 89 def issuer @issuer ||= begin node = REXML::XPath.first( document, "/p:LogoutRequest/a:Issuer", { "p" => PROTOCOL, "a" => ASSERTION } ) node.nil? ? nil : node.text end end |
#name_id ⇒ String Also known as: nameid
Returns Gets the NameID of the Logout Request.
72 73 74 75 76 77 |
# File 'lib/onelogin/kl-ruby-saml/slo_logoutrequest.rb', line 72 def name_id @name_id ||= begin node = REXML::XPath.first(document, "/p:LogoutRequest/a:NameID", { "p" => PROTOCOL, "a" => ASSERTION }) node.nil? ? nil : node.text 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/kl-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 |
#reset_errors! ⇒ Object
Reset the errors array
59 60 61 |
# File 'lib/onelogin/kl-ruby-saml/slo_logoutrequest.rb', line 59 def reset_errors! @errors = [] 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 126 127 128 129 130 |
# File 'lib/onelogin/kl-ruby-saml/slo_logoutrequest.rb', line 117 def session_indexes s_indexes = [] nodes = REXML::XPath.match( document, "/p:LogoutRequest/p:SessionIndex", { "p" => PROTOCOL } ) nodes.each do |node| s_indexes << node.text end s_indexes end |