我試圖從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證書。
我是否需要設置某種信任或進一步的東西?此錯誤消息不是特別有用。
而且您還必須指定一個AppliesTo。 – leastprivilege