Commit cb9c6ff

mo <mo.khan@gmail.com>
2017-11-17 23:53:54
LogoutRequest < Document
1 parent bb61e26
Changed files (2)
lib/saml/kit/invalid_document.rb
@@ -6,7 +6,7 @@ module Saml
       end
 
       def initialize(xml)
-        super(xml, "InvalidDocument")
+        super(xml, name: "InvalidDocument")
       end
     end
   end
lib/saml/kit/logout_request.rb
@@ -1,9 +1,6 @@
 module Saml
   module Kit
-    class LogoutRequest
-      PROTOCOL_XSD = File.expand_path("./xsd/saml-schema-protocol-2.0.xsd", File.dirname(__FILE__)).freeze
-      include XsdValidatable
-      include ActiveModel::Validations
+    class LogoutRequest < Document
       validates_presence_of :content
       validates_presence_of :single_logout_service, if: :logout?
       validate :must_be_request
@@ -11,12 +8,8 @@ module Saml
       validate :must_be_registered
       validate :must_match_xsd
 
-      attr_reader :content, :name
-
       def initialize(xml)
-        @content = xml
-        @name = "LogoutRequest"
-        @xml_hash = Hash.from_xml(xml)
+        super(xml, name: "LogoutRequest")
       end
 
       def query_string_parameter
@@ -53,14 +46,6 @@ module Saml
         return urls.first[:location] if urls.any?
       end
 
-      def to_h
-        @xml_hash
-      end
-
-      def to_xml
-        @content
-      end
-
       def trusted?
         return false if provider.nil?
         return false unless signed?
@@ -85,10 +70,6 @@ module Saml
         to_h[name]['Signature'].present?
       end
 
-      def to_s
-        to_xml
-      end
-
       def response_for(user)
         LogoutResponse::Builder.new(user, self).build
       end