-
Notifications
You must be signed in to change notification settings - Fork 32
Closed
Description
In the initializer for Saml::Elements::KeyInfo
, the key_name
attribute is automatically generated.
When we try to do the following where the key defined in the IdP metadata has no ds:KeyName
assigned:
saml_response = Saml::Response.new(...)
artifact_response = Saml::ArtifactResponse.new(status_value: Saml::TopLevelCodes::SUCCESS,
issuer: 'https://idp.example.com',
destination: 'https://sp.example.com/acs')
artifact_response.response = saml_response
artifact_resolution_url = Saml.provider( 'https://idp.example.com').artifact_resolution_service_url
stub_request(:post, artifact_resolution_url).to_return(body: Saml::Util.sign_xml(artifact_response, :soap))
request = ... # A mock request object with SAMLart set to some arbitrary value
Saml::Bindings::HTTPArtifact.resolve(request, artifact_resolution_url)
Then we will get a SignatureInvalid
error. This is because in Saml::Provider.verify
, it tries to find a key with the ID generated during the signing, but this key in the IdP metadata has no name and is thus not found. Thus the call certificate(key_name).public_key.verify(digest_method(signature_algorithm).new, signature, data)
in Saml::Provider.verify
fails because certificate(key_name)
returns nil
.
Metadata
Metadata
Assignees
Labels
No labels