代码之家  ›  专栏  ›  技术社区  ›  amritanshu

SSPI协商在WSTrustChannelFactory中失败

  •  0
  • amritanshu  · 技术社区  · 7 年前

    这一个我现在有一段时间了,我正在尝试建立一个控制台应用程序,可以调用。net web/wcf服务SP,第一步是从idP(ADFS4.0)获取令牌。粘贴的代码整整工作了一天,在某些情况下停止工作,出现以下错误:

    SOAP security negotiation with 'https://adfs.domain.in/adfs/services/trust/13/windowsmixed' for target 'https://adfs.domain.in/adfs/services/trust/13/windowsmixed' failed. See inner exception for more details.

    The Security Support Provider Interface (SSPI) negotiation failed.
    NativeErrorCode: 0x80090350 -> SEC_E_DOWNGRADE_DETECTED

    我已经尝试了/13/windows和/windowstransport以及端点。

    private static GenericXmlSecurityToken RequestSecurityToken()
    {
        // set up the ws-trust channel factory
        var factory = new Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannelFactory(new WindowsWSTrustBinding(
                    SecurityMode.TransportWithMessageCredential), new EndpointAddress(new Uri("https://adfs.domain.in/adfs/services/trust/13/windowsmixed"), EndpointIdentity.CreateSpnIdentity("adfs@domain.in")));
        factory.TrustVersion = TrustVersion.WSTrust13;
        var rst = new RequestSecurityToken
        {
            RequestType = RequestTypes.Issue,
            KeyType = KeyTypes.Bearer,
            AppliesTo = new System.ServiceModel.EndpointAddress(endpoint_address)
        };
        // request token and return
        return factory.CreateChannel().Issue(rst) as GenericXmlSecurityToken;
    }
    
    1 回复  |  直到 7 年前
        1
  •  0
  •   amritanshu    7 年前

    在我的例子中,出于某种原因,ADF可以通过VPN使用,但基于AD的身份验证位不能通过VPN使用。这就是为什么检测到的SEC\u E\u降级即将到来。在常规的非VPN环境中,情况很好。

    此外,另一个观察是,一旦通过常规企业网络生成SAML令牌。即使在VPN上,生成SAML令牌的后续调用也按预期进行。

    因此,如果您看到这个错误,只需检查您所在的网络是否是域的一部分(而不是公共或私有网络),以进行SSPI协商。