Commit c28de09

mo <mo.khan@gmail.com>
2017-11-10 20:47:51
parse -> deserialize.
1 parent 77dc9f8
Changed files (2)
lib
saml
spec
lib/saml/kit/response.rb
@@ -97,8 +97,8 @@ module Saml
         Time.current > started_at && !expired?
       end
 
-      def self.parse(saml_response)
-        new(Base64.decode64(saml_response))
+      def self.deserialize(saml_response)
+        new(Saml::Kit::Content.decode_raw_saml(saml_response))
       end
 
       private
spec/saml/response_spec.rb
@@ -65,12 +65,12 @@ RSpec.describe Saml::Kit::Response do
     end
   end
 
-  describe ".parse" do
+  describe ".deserialize" do
     subject { described_class }
     let(:raw_response) { IO.read('spec/fixtures/encoded_response.txt') }
 
     it 'decodes the response to the raw xml' do
-      result = Hash.from_xml(subject.parse(raw_response).to_xml)
+      result = Hash.from_xml(subject.deserialize(raw_response).to_xml)
       expect(result['Response']['ID']).to eql('_75358cd9-f357-4b2d-999f-f53382ba8263')
       expect(result['Response']['Version']).to eql('2.0')
       expect(result['Response']['IssueInstant']).to eql("2017-10-22T23:36:44Z")