最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin0浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论