Commit 6dd651c

mo <mo@mokhan.ca>
2017-12-13 17:00:51
use Forwardable to remove duplication.
1 parent 2b94e4f
Changed files (1)
lib
saml
lib/saml/kit/response.rb
@@ -2,6 +2,9 @@ module Saml
   module Kit
     class Response < Document
       include Respondable
+      extend Forwardable
+
+      def_delegators :assertion, :name_id, :[], :attributes, :started_at, :expired_at, :audiences
 
       validate :must_be_active_session
       validate :must_match_issuer
@@ -11,26 +14,6 @@ module Saml
         super(xml, name: "Response")
       end
 
-      def name_id
-        assertion.name_id
-      end
-
-      def [](key)
-        attributes[key]
-      end
-
-      def attributes
-        assertion.attributes
-      end
-
-      def started_at
-        assertion.started_at
-      end
-
-      def expired_at
-        assertion.expired_at
-      end
-
       def expired?
         Time.current > expired_at
       end
@@ -68,10 +51,6 @@ module Saml
         end
       end
 
-      def audiences
-        assertion.audiences
-      end
-
       Builder = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Saml::Kit::Response::Builder', 'Saml::Kit::Builders::Response')
     end
   end