【问题标题】:Why i get this Error : "The issuer of the security token was not recognized by the IssuerNameRegistry"为什么我会收到此错误:“IssuerNameRegistry 无法识别安全令牌的发行者”
【发布时间】:2014-01-10 16:56:40
【问题描述】:

当我想使用自定义 STS 运行我的应用程序时(我已经编写了它并且效果很好),首先我得到了这个错误:

安全令牌的发行者未被 IssuerNameRegistry 识别

我测试了这个错误的所有解决方案,但我仍然有这个错误。

我添加了“TrustedIssuerNameRegistery”类并在 web.config 中设置。

public class TrustedIssuerNameRegistery : IssuerNameRegistry
{
    string issuerName = string.Empty;
    public override string GetIssuerName(SecurityToken securityToken)
    {
        if (securityToken != null)
        {
            X509SecurityToken x509Cert = securityToken as X509SecurityToken;
            if (x509Cert != null && x509Cert.Certificate.SubjectName.Name == "CN=busta-ip1sts.com")
            {
                issuerName = x509Cert.Certificate.SubjectName.Name;
            }
        }
        if (string.IsNullOrEmpty(issuerName))
        {
            throw new SecurityTokenException("Untrusted issuer.");
        }

        return issuerName;
    }

    public override string GetIssuerName(System.IdentityModel.Tokens.SecurityToken securityToken, string requestedIssuerName)
    {
        return base.GetIssuerName(securityToken, requestedIssuerName);
    }
}

这是 web.config 设置:

<issuerNameRegistry type='Webapp1.TrustedIssuerNameRegistry' />

然后我得到这个错误:

***ID8030: The value of the 'type' property could not be parsed.Verify that the type attribute of '<issuerNameRegistry type="Webapp1.TrustedIssuerNameRegistry,webapp1">***

我什至安装了 "ValidatingIssuerNameRegistry" dll 并在 web.config 中注册了它,但我又遇到了第一个错误。

为什么我经常收到这个错误?它有什么问题?我还能做什么? 如果你愿意,我也可以给你我的源代码。

【问题讨论】:

    标签: certificate single-sign-on wif sts-securitytokenservice ws-federation


    【解决方案1】:

    看起来您还需要程序集名称:“WebApp1.TrustedIssuerNameRegistry, AssemblyName”。

    附带说明——我希望颁发者名称注册表仅用于测试——这是不安全的,因为任何人都可以使用该主题名称创建证书。

    【讨论】:

    • 是的,只是为了测试
    猜你喜欢
    • 2013-12-18
    • 2011-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-20
    • 2018-06-22
    • 2016-01-01
    相关资源
    最近更新 更多