Class: Onelogin::Saml::Logoutresponse
- Inherits:
-
Object
- Object
- Onelogin::Saml::Logoutresponse
- Defined in:
- lib/onelogin/ruby-saml/logoutresponse.rb
Constant Summary collapse
- ASSERTION =
"urn:oasis:names:tc:SAML:2.0:assertion"
- PROTOCOL =
"urn:oasis:names:tc:SAML:2.0:protocol"
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#in_response_to ⇒ Object
readonly
Returns the value of attribute in_response_to.
-
#issuer ⇒ Object
readonly
Returns the value of attribute issuer.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#settings ⇒ Object
For API compability, this is mutable.
Instance Method Summary collapse
-
#initialize(response, settings = nil, options = {}) ⇒ Logoutresponse
constructor
In order to validate that the response matches a given request, append the option: :matches_request_id => REQUEST_ID.
- #success?(soft = true) ⇒ Boolean
- #validate(soft = true) ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(response, settings = nil, options = {}) ⇒ Logoutresponse
In order to validate that the response matches a given request, append the option:
:matches_request_id => REQUEST_ID
It will validate that the logout response matches the ID of the request. You can also do this yourself through the in_response_to accessor.
31 32 33 34 35 36 37 38 39 |
# File 'lib/onelogin/ruby-saml/logoutresponse.rb', line 31 def initialize(response, settings = nil, = {}) raise ArgumentError.new("Logoutresponse cannot be nil") if response.nil? self.settings = settings @options = @raw_response = response parse_logoutresponse end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
17 18 19 |
# File 'lib/onelogin/ruby-saml/logoutresponse.rb', line 17 def document @document end |
#in_response_to ⇒ Object (readonly)
Returns the value of attribute in_response_to.
21 22 23 |
# File 'lib/onelogin/ruby-saml/logoutresponse.rb', line 21 def in_response_to @in_response_to end |
#issuer ⇒ Object (readonly)
Returns the value of attribute issuer.
21 22 23 |
# File 'lib/onelogin/ruby-saml/logoutresponse.rb', line 21 def issuer @issuer end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
18 19 20 |
# File 'lib/onelogin/ruby-saml/logoutresponse.rb', line 18 def @options end |
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
20 21 22 |
# File 'lib/onelogin/ruby-saml/logoutresponse.rb', line 20 def raw_response @raw_response end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
19 20 21 |
# File 'lib/onelogin/ruby-saml/logoutresponse.rb', line 19 def response @response end |
#settings ⇒ Object
For API compability, this is mutable.
15 16 17 |
# File 'lib/onelogin/ruby-saml/logoutresponse.rb', line 15 def settings @settings end |
Instance Method Details
#success?(soft = true) ⇒ Boolean
51 52 53 54 55 56 |
# File 'lib/onelogin/ruby-saml/logoutresponse.rb', line 51 def success?(soft = true) unless @status_code == "urn:oasis:names:tc:SAML:2.0:status:Success" return soft ? false : validation_error("Bad status code. Expected <urn:oasis:names:tc:SAML:2.0:status:Success>, but was: <#@status_code> ") end true end |
#validate(soft = true) ⇒ Object
45 46 47 48 49 |
# File 'lib/onelogin/ruby-saml/logoutresponse.rb', line 45 def validate(soft = true) return false unless valid_saml?(soft) && valid_state?(soft) valid_in_response_to?(soft) && valid_issuer?(soft) && success?(soft) end |
#validate! ⇒ Object
41 42 43 |
# File 'lib/onelogin/ruby-saml/logoutresponse.rb', line 41 def validate! validate(false) end |