Commit e5f29fb
Changed files (2)
lib
saml
kit
spec
saml
lib/saml/kit/binding.rb
@@ -18,7 +18,7 @@ module Saml
builder.destination = location
document = builder.build
[UrlBuilder.new.build(document, relay_state: relay_state), {}]
- else
+ elsif post?
builder = document_type::Builder.new(sign: true)
builder.destination = location
document = builder.build
@@ -27,6 +27,8 @@ module Saml
'RelayState' => relay_state,
}
[location, saml_params]
+ else
+ []
end
end
@@ -34,6 +36,10 @@ module Saml
binding == Namespaces::HTTP_REDIRECT
end
+ def post?
+ binding == Namespaces::POST
+ end
+
def to_h
{ binding: binding, location: location }
end
spec/saml/binding_spec.rb
@@ -32,5 +32,10 @@ RSpec.describe Saml::Kit::Binding do
expect(xml['AuthnRequest']['Signature']).to be_present
end
end
+
+ it 'ignores other bindings' do
+ subject = Saml::Kit::Binding.new(binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact', location: location)
+ expect(subject.serialize(Saml::Kit::AuthenticationRequest)).to be_empty
+ end
end
end