How FusionAuth Verifies SAML v2 Signatures

On this page

FusionAuth verifies the signature on every SAML response from a SAML v2 Identity Provider. FusionAuth trusts only the keys in Verification keys on the Identity Provider. A certificate in Key MasterThe FusionAuth subsystem for managing cryptographic keys. that isn't in Verification keys can't verify a response.

Key Selection#

FusionAuth chooses the verification key as follows:

  • When the signature includes an X.509A standard format for public key certificates. certificate in the KeyInfo element, FusionAuth computes the SHA-1 thumbprint of the certificate. FusionAuth then verifies the signature with the key in Verification keys whose certificate has the same thumbprint. The order of the keys doesn't matter. When no key matches, FusionAuth rejects the response.
  • When the signature doesn't include a certificate, FusionAuth verifies the signature with the default key. The default key is the key marked Default in the Admin UI, and the first key in verificationKeyIds in the API.
YesYesNoNoSAML response arrivesDoes KeyInfo contain anX.509 certificate?Does a certificate inVerification keys have thesame SHA-1 thumbprint?Verify the signature withthe matching certificateReject the responseVerify the signature withthe default key
YesYesNoNoSAML response arrivesDoes KeyInfo contain anX.509 certificate?Does a certificate inVerification keys have thesame SHA-1 thumbprint?Verify the signature withthe matching certificateReject the responseVerify the signature withthe default key

FusionAuth chooses the key that verifies the signature on a SAML response from an external Identity Provider.

Caution

A verification key that contains only a public key, without a certificate, never matches the certificate in KeyInfo. A public key can verify a response only as the default key, and only when the signature doesn't include a certificate. When the Identity Provider gives you a certificate, import the certificate.

When no key matches, the Event Log contains Invalid SAML v2.0 operation. The signature is invalid. For the steps to find the missing certificate, see Troubleshooting.

Certificate Rotation#

Many Identity Providers publish more than one signing certificate in their metadata. The extra certificates let a service provider trust a new certificate before the Identity Provider starts to sign with the new certificate.

FusionAuth matches each response to a certificate by thumbprint, so Verification keys can hold the old and new certificates at the same time. Logins keep working while the Identity Provider switches certificates. Import each published certificate into Key Master, and add each certificate to Verification keys. Mark the certificate that the Identity Provider currently signs with as Default, for responses whose signature doesn't include a certificate. After the Identity Provider stops signing with the old certificate, remove the old certificate from Verification keys.

For more information, see Key Master.