2
我本來以爲一個基本上可以切換從該客戶端憑證:如何指定證書爲憑證與wsTrustChannel Thinktecture IdentityServer
var clientCredentials = new ClientCredentials();
clientCredentials.UserName.UserName = "MyUserName"
clientCredentials.UserName.Password = "MyPassword"
到:
var clientCredentials = new ClientCredentials();
clientCredentials.ClientCertificate.Certificate = myX509Certificate;
,然後創建一個wsTrustChannel來獲取安全令牌。
wsTrustChannelFactory.SetCredentials(clientCredentials);
var channel = _wsTrustChannelFactory.CreateChannel(new EndpointAddress(endpointAddress));
var token = channel.Issue(new RequestSecurityToken
{
TokenType = tokenType,
AppliesTo = new EndpointReference(realm),
RequestType = RequestTypes.Issue,
KeyType = KeyTypes.Bearer
}, out requestSecurityTokenResponse);
的用戶名和密碼,做工精細,只是用證書抱怨,有沒有指定的用戶名。我的印象是令牌發行者會從證書中查找關聯的用戶。我在哪裏錯了?