Commit c6b0921

mo <mo.khan@gmail.com>
2018-02-26 02:36:49
parse ACS using xpath.
1 parent 9cc1812
Changed files (2)
lib/saml/kit/authentication_request.rb
@@ -31,7 +31,7 @@ module Saml
       # Extract the AssertionConsumerServiceURL from the AuthnRequest
       #    <samlp:AuthnRequest AssertionConsumerServiceURL="https://carroll.com/acs"></samlp:AuthnRequest>
       def assertion_consumer_service_url
-        to_h[name]['AssertionConsumerServiceURL']
+        at_xpath('./*/@AssertionConsumerServiceURL').try(:value)
       end
 
       # Extract the NameIDPolicy from the AuthnRequest
spec/saml/kit/authentication_request_spec.rb
@@ -22,11 +22,11 @@ RSpec.describe Saml::Kit::AuthenticationRequest do
     end
   end
 
-  it { expect(subject.issuer).to eql(issuer) }
-  it { expect(subject.id).to eql(id) }
-  it { expect(subject.assertion_consumer_service_url).to eql(assertion_consumer_service_url) }
-  it { expect(subject.name_id_format).to eql(name_id_format) }
-  it { expect(subject.destination).to eql(destination) }
+  specify { expect(subject.issuer).to eql(issuer) }
+  specify { expect(subject.id).to eql(id) }
+  specify { expect(subject.assertion_consumer_service_url).to eql(assertion_consumer_service_url) }
+  specify { expect(subject.name_id_format).to eql(name_id_format) }
+  specify { expect(subject.destination).to eql(destination) }
 
   describe '#valid?' do
     let(:registry) { instance_double(Saml::Kit::DefaultRegistry) }