【发布时间】:2021-12-22 22:09:01
【问题描述】:
我们在调用 Unbind() 时收到“签名无效”错误,并在代码中偶然发现了这一点。
https://github.com/ITfoxtec/ITfoxtec.Identity.Saml2/blob/42a2d6de46f38d14f0c6f607594d19f2366ad5f2/src/ITfoxtec.Identity.Saml2/Bindings/Saml2PostBinding.cs#L106
为什么validateXmlSignature 参数总是true 在UnbindInternal() 内?
protected override Saml2Request UnbindInternal(HttpRequest request, Saml2Request saml2RequestResponse, string messageName)
{
UnbindInternal(request, saml2RequestResponse);
return Read(request, saml2RequestResponse, messageName, true, true);
}
我们的调用代码:
var binding = new Saml2PostBinding();
var saml2AuthnResponse = new Saml2AuthnResponse(saml2Config);
binding.ReadSamlResponse(Request.ToGenericHttpRequest(), saml2AuthnResponse);
if (saml2AuthnResponse.Status != Saml2StatusCodes.Success)
{
throw new AuthenticationException($"SAML Response status: {saml2AuthnResponse.Status}");
}
binding.Unbind(Request.ToGenericHttpRequest(), saml2AuthnResponse);
【问题讨论】: