【问题标题】:Client certificate with Hybrid Authentication Flow具有混合身份验证流程的客户端证书
【发布时间】:2017-01-13 01:32:39
【问题描述】:

我正在使用 IdentityServer3 开发一个身份验证/授权服务器,到目前为止一切正常。

我正在尝试通过 X509Certificate 而不是示例中的散列密钥来验证混合流客户端。

我的问题是:如何配置客户端应用程序以发送认证流程的证书?

我在X509CertificateSecretParser.cs 的源代码中看到,为了获取客户端证书,owin 环境变量“ssl.ClientCertificate”必须有一个值,但我找不到这个值的设置位置,即使在 Microsoft。 Owin源代码。

我也尝试使用我在服务器上加载的证书作为客户端应用程序的 SSL 证书,但这也不起作用。

设置客户端密码的代码:

[my client].ClientSecrets.Add(new Secret
{
    Value = Convert.ToBase64String(cert.Export(X509ContentType.Cert)),
    Type = Constants.SecretTypes.X509CertificateBase64
});

客户端应用程序的设置去验证代码:

app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
    Authority = ...,
    Scope = ...,
    ClientId = ...,
    RedirectUri = ...,
    ResponseType = "code id_token token",
    ClientSecret = "" , //What should I do with this?
    SignInAsAuthenticationType = "Cookies",
    Notifications = new OpenIdConnectAuthenticationNotifications
    {
        RedirectToIdentityProvider = ...,
        AuthorizationCodeReceived = ...
    }
});

【问题讨论】:

    标签: c# asp.net-mvc oauth-2.0 identityserver3 openid-connect


    【解决方案1】:

    a) 您需要在 IIS 上启用客户端证书 - 我们的主机已将其注释掉:

    https://github.com/IdentityServer/IdentityServer3/blob/master/source/Host.Web/Web.config#L19

    这将在成功的 HTTPS 握手后填充 OWIN SSL 环境变量。

    b) OpenID Connect 中间件不会自动为您联系令牌端点。您需要手动执行此操作。这样您就可以配置要使用的客户端证书。这是一个示例:

    https://github.com/IdentityServer/IdentityServer3.Samples/blob/master/source/Clients/ClientCertificateConsoleClient/Program.cs#L26

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-26
      • 1970-01-01
      • 1970-01-01
      • 2011-11-04
      • 2012-01-03
      • 2011-04-09
      • 2013-10-07
      • 1970-01-01
      相关资源
      最近更新 更多