0

这个已经有一段时间了,我正在尝试构建一个可以调用 .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;
}
4

1 回答 1

0

就我而言,出于某种原因,ADFS 可通过 VPN 使用,但基于 AD 的身份验证位并未通过 VPN 发生。这就是 SEC_E_DOWNGRADE_DETECTED 即将到来的原因。在常规的非 VPN 环境中,一切都很好。

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

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

于 2017-09-19T07:58:26.840 回答