Commit 9cc1812

mo <mo.khan@gmail.com>
2018-02-26 02:34:44
parse InResponseTo with xpath.
1 parent d3ce092
Changed files (2)
lib
spec
lib/saml/kit/respondable.rb
@@ -21,7 +21,7 @@ module Saml
 
       # Returns the /InResponseTo attribute.
       def in_response_to
-        to_h.fetch(name, {}).fetch('InResponseTo', nil)
+        at_xpath('./*/@InResponseTo').try(:value)
       end
 
       # Returns true if the Status code is #{Saml::Kit::Namespaces::SUCCESS}
spec/saml/kit/response_spec.rb
@@ -5,6 +5,7 @@ RSpec.describe Saml::Kit::Response do
   let(:user) { User.new(attributes: { id: SecureRandom.uuid }) }
 
   specify { expect(subject.status_code).to eql(Saml::Kit::Namespaces::SUCCESS) }
+  specify { expect(subject.in_response_to).to eql(request.id) }
 
   describe '#valid?' do
     subject { described_class.build(user, request, configuration: configuration) }