2013-09-25 62 views
3

我试图从ADFS获取令牌,以便我可以将它用于本地Windows Service Bus安装。我可能没有正确配置ADFS,因为我收到以下消息:从ADFS获取令牌

MSIS3127:指定的请求失败。

代码访问令牌如下:

string adrecaSTS = "trust/13/usernamemixed"; 

    WS2007HttpBinding binding = new WS2007HttpBinding(); 

    binding.Security.Message.EstablishSecurityContext = false; 
    binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; 
    binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName; 
    binding.Security.Mode = SecurityMode.TransportWithMessageCredential; //https 

    string baseSSLUri = @"https://<myadfs>/adfs/services/"; 



    WSTrustChannelFactory trustChannelFactory = new WSTrustChannelFactory(binding, new EndpointAddress(baseSSLUri + adrecaSTS)); 
    trustChannelFactory.TrustVersion = TrustVersion.WSTrust13; 
    trustChannelFactory.Credentials.UserName.UserName = "username"; 
    trustChannelFactory.Credentials.UserName.Password = "password"; 

    WSTrustChannel tokenClient = (WSTrustChannel)trustChannelFactory.CreateChannel(); 

    //create a token issuance issuance 
    RequestSecurityToken rst = new RequestSecurityToken(RequestTypes.Issue); 

    //call ADFS STS 
    SecurityToken token = tokenClient.Issue(rst); 

端点上启用ADFS和我的客户(独立域上的笔记本电脑)信任从ADFS证书。

我是否需要设置某种信任或进一步的东西?此错误消息不是特别有用。

回答

0

发现此问题。我试图以管理员帐户登录。当我使用普通用户时,它工作。

我也不得不修改RequestSecurityToken有KeyType.Symmetric

的关键字类型
+0

而且您还必须指定一个AppliesTo。 – leastprivilege