【问题标题】:How to specify a certificate as the credentials for a wsTrustChannel with Thinktecture IdentityServer如何使用 Thinktecture IdentityServer 指定证书作为 wsTrustChannel 的凭据
【发布时间】:2014-04-04 00:37:34
【问题描述】:

我原以为基本上可以从这里切换客户端凭据:

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);

用户名和密码工作正常,只是使用证书抱怨没有指定用户名。我的印象是令牌发行者会从证书中查找关联的用户。我哪里错了?

【问题讨论】:

    标签: federated-identity thinktecture-ident-server ws-trust


    【解决方案1】:

    编辑 - 双重呐喊!我在端点使用 UserNameWSTrustBinding,而我显然应该使用 CertificateWSTrustBinding。进行此更改解决了此问题。


    编辑 - 我以为我已经解决了这个问题,但即使在这个端点上它仍然要求用户名。有什么想法吗?


    哎呀!在我发布上述问题后大约 5 分钟解决了这个问题。证书认证有不同的端点地址:

    https://servername/identityserver/issue/wstrust/mixed/certificate
    

    而不是

    https://servername/identityserver/issue/wstrust/mixed/username
    

    【讨论】:

      猜你喜欢
      • 2014-12-26
      • 1970-01-01
      • 2014-04-22
      • 1970-01-01
      • 2016-05-03
      • 2014-08-01
      • 2014-09-25
      • 2015-10-17
      • 2015-05-02
      相关资源
      最近更新 更多