0

当我想使用自定义 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 中注册了它,但我又遇到了第一个错误。

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

4

1 回答 1

1

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

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

于 2013-12-22T15:10:53.897 回答