itfoxtec identity saml2 - SAML response signatures are always validated - Stack Overflow

I am using ITfoxtec.Identity.Saml2.MvcCore 4.11.3 in dotnet 8.I am getting intermittent Signature is i

I am using ITfoxtec.Identity.Saml2.MvcCore 4.11.3 in dotnet 8.

I am getting intermittent Signature is invalid. exceptions in ITfoxtec.Identity.Saml2.Saml2Request.ValidateXmlSignature(SignatureValidation documentValidationResult).

It is the SAML response that is failing validation, triggered by my call to binding.Unbind in my SP AssertionConsumerService postback handler.

I don't know what the cause of the invalid signatures is, and the response's Assertion element is signed with the same X509Data public key in both the valid and invalid cases.

The fact that it could fail at all was a surprise, as I have CertificateValidationMode set to None in config. I stepped through the latest github code, without being able to reproduce an exception, and verified that CertificateValidationMode was indeed None at the point it reaches Saml2Request.MustValidateXmlSignature and ValidateXmlSignature.

But this code here in Saml2PostBinding.UnbindInternal is passing in a hardcoded true for the validate parameter, which causes MustValidateXmlSignature to return true.

Why does it do this, instead of passing false when CertificateValidationMode is None?

How can I disable signature validation, which the project didn't require to be enabled, and so avoid having to troubleshoot the unwanted exceptions that are now happening?

I am using ITfoxtec.Identity.Saml2.MvcCore 4.11.3 in dotnet 8.

I am getting intermittent Signature is invalid. exceptions in ITfoxtec.Identity.Saml2.Saml2Request.ValidateXmlSignature(SignatureValidation documentValidationResult).

It is the SAML response that is failing validation, triggered by my call to binding.Unbind in my SP AssertionConsumerService postback handler.

I don't know what the cause of the invalid signatures is, and the response's Assertion element is signed with the same X509Data public key in both the valid and invalid cases.

The fact that it could fail at all was a surprise, as I have CertificateValidationMode set to None in config. I stepped through the latest github code, without being able to reproduce an exception, and verified that CertificateValidationMode was indeed None at the point it reaches Saml2Request.MustValidateXmlSignature and ValidateXmlSignature.

But this code here in Saml2PostBinding.UnbindInternal is passing in a hardcoded true for the validate parameter, which causes MustValidateXmlSignature to return true.

Why does it do this, instead of passing false when CertificateValidationMode is None?

How can I disable signature validation, which the project didn't require to be enabled, and so avoid having to troubleshoot the unwanted exceptions that are now happening?

Share Improve this question edited Nov 19, 2024 at 22:03 user22958864 asked Nov 19, 2024 at 21:53 user22958864user22958864 335 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

The CertificateValidationMode control rather the certificate it self should be validated, not if the message signature should be validated.

The binding.UnBind method always validate the signature and checks the message. The binding.ReadSamlResponse method only reads the message without validate the signature. If the UnBind method succeed, the message is validated and approved.

The signature is validated with the certificates in saml2Configuration.SignatureValidationCertificates. Downloaded from the IdP like this.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742396267a4436008.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信