itfoxtec-identity-saml2 - 调用 Saml2PostBinding.Unbind() 时签名无效
问题描述
我们在调用时遇到“签名无效”错误,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);
解决方案
该validateXmlSignature
参数始终是true
因为签名放置在 POST 绑定中的 XML 中,并且必须验证 SAML 2.0 Authn 响应签名。签名验证是对 SAML 2.0 令牌的信任。
推荐阅读
- javascript - 切换到 Typescript 后找不到 App.js
- javascript - JavaScript 算法通过删除最多一个字符来检查回文 - 这种递归方法的时间复杂度
- reactjs - 情感 - 导入项目并出现错误 TypeError: Object(...) is not a function
- pine-script - 不断收到此消息:不能使用可变变量作为安全函数的参数
- python - 张量流错误:不支持将字符串转换为浮点数
- twitter-bootstrap - Bootstrap 导航栏折叠成一个整洁的列表
- sqlite - 如何对额外列中的行元素求和并找出某些字段大于 x 的数据?
- java - 关于带有日期和随机数的程序的问题
- angular - FormGroup.value 返回默认值而不是更新的值
- c# - 在 C# 中对整数三元组数组进行排序