Commit 0ced388

mo <mo@mokhan.ca>
2018-10-22 16:02:46
forward changes to the destination to the assertion
1 parent 1e68172
Changed files (2)
lib
saml
kit
builders
spec
saml
kit
lib/saml/kit/builders/response.rb
@@ -55,6 +55,11 @@ module Saml
             end
         end
 
+        def destination=(value)
+          @destination = value
+          assertion.destination = value
+        end
+
         private
 
         def response_options
spec/saml/kit/builders/response_spec.rb
@@ -218,5 +218,13 @@ RSpec.describe Saml::Kit::Builders::Response do
       expect(result).to be_signed
       expect(result.signature.certificate).to eql(key_pair.certificate)
     end
+
+    it 'specifies the recipient on the subject confirmation data' do
+      acs_url = FFaker::Internet.uri('https')
+      subject.assertion # force memoization the assertion
+      subject.destination = acs_url
+      result = subject.build
+      expect(result.assertion.at_xpath('/samlp:Response/saml:Assertion/saml:Subject/saml:SubjectConfirmation/saml:SubjectConfirmationData').attribute('Recipient').value).to eql(acs_url)
+    end
   end
 end