You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ITfoxtec Saml2调用Bind报错:签名证书无RSA私钥(Azure AD .cer)

SAML2重定向登录请求绑定时报私钥缺失异常

我看过相关帖子,但没弄明白解答内容。我尝试用下面的示例代码实现将客户端重定向到登录提供商的登录功能:

public IActionResult RedirectToLogin(LoginInfo loginInfo)
{
    var binding = new Saml2RedirectBinding();

    var roundTripInfo = new Dictionary<string, string>
    {
        // some stuff
    };

    binding.SetRelayStateQuery(roundTripInfo);

    return binding.Bind(new Saml2AuthnRequest(config)).ToActionResult();
}

调用.Bind方法时抛出了如下异常:

No RSA Private Key present in Signing Certificate or missing private key read credentials.

我用的是Azure Active Directory提供的.cer文件,为什么会要求私钥?

补充 - 配置信息

我检查了appsettings,里面并没有SigningCertificateFile或SigningCertificatePassword属性,但还是出现了这个错误:

"Saml2": {
    "CertificateValidationMode": "None", // or "ChainTrust"
    "IdPMetadata": "...[redacted]...",
    "Issuer": "...[redacted]...",
    "RevocationMode": "NoCheck",
    "SignatureAlgorithm": "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",
},

内容的提问来源于stack exchange,提问作者Scott Baker

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 11:27:16