Skip to content

Commit 2d2c77f

Browse files
authored
Update Saml2Request.cs
Hi Anders, this is a small update to the signature validation. We have increased number of Claims Providers, that have more than one certificate in the metadata, and not all certificates are valid (this is due to OCES2->OCES3 migration). So even though, they already started signing with OCES3, they still have OCES2 in the metadata. The change ensure, that we validate only the certificate that was used to create a signature. What do you think? Regards, Greg
1 parent 8327721 commit 2d2c77f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ITfoxtec.Identity.Saml2/Request/Saml2Request.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,13 @@ protected SignatureValidation ValidateXmlSignature(XmlElement xmlElement)
263263

264264
foreach (var signatureValidationCertificate in SignatureValidationCertificates)
265265
{
266-
IdentityConfiguration.CertificateValidator.Validate(signatureValidationCertificate);
267-
268266
var signedXml = new Saml2SignedXml(xmlElement, signatureValidationCertificate, SignatureAlgorithm, XmlCanonicalizationMethod);
269267
signedXml.LoadXml(xmlSignatures[0] as XmlElement);
270268
if (signedXml.CheckSignature())
271269
{
270+
// Check if certificate used to sign is valid
271+
IdentityConfiguration.CertificateValidator.Validate(signatureValidationCertificate);
272+
272273
// Signature is valid.
273274
return SignatureValidation.Valid;
274275
}

0 commit comments

Comments
 (0)