Commit 5cd2a30
Changed files (4)
lib
lib/saml/kit/logout_response.rb
@@ -1,6 +1,8 @@
module Saml
module Kit
class LogoutResponse < Document
+ include Respondable
+
def initialize(xml)
super(xml, name: "LogoutResponse", query_string_parameter: 'SAMLResponse')
end
@@ -9,10 +11,6 @@ module Saml
to_h[name]['IssueInstant']
end
- def status_code
- to_h[name]['Status']['StatusCode']['Value']
- end
-
def in_response_to
to_h[name]['InResponseTo']
end
lib/saml/kit/respondable.rb
@@ -0,0 +1,9 @@
+module Saml
+ module Kit
+ module Respondable
+ def status_code
+ to_h.fetch(name, {}).fetch('Status', {}).fetch('StatusCode', {}).fetch('Value', nil)
+ end
+ end
+ end
+end
lib/saml/kit/response.rb
@@ -1,6 +1,8 @@
module Saml
module Kit
class Response < Document
+ include Respondable
+
attr_reader :request_id
validates_presence_of :content
validates_presence_of :id
@@ -28,10 +30,6 @@ module Saml
to_h.fetch(name, {}).fetch('Assertion', {}).fetch('Subject', {}).fetch('NameID', nil)
end
- def status_code
- to_h.fetch(name, {}).fetch('Status', {}).fetch('StatusCode', {}).fetch('Value', nil)
- end
-
def [](key)
attributes[key]
end
lib/saml/kit.rb
@@ -14,6 +14,7 @@ require "xmldsig"
require "saml/kit/serializable"
require "saml/kit/xsd_validatable"
+require "saml/kit/respondable"
require "saml/kit/trustable"
require "saml/kit/document"