使用WtrustChannelFactory进行SSPI协商失败

时间:2017-09-19 06:39:48

标签: windows single-sign-on adfs sspi

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

0 个答案:

没有答案