【发布时间】:2016-05-18 21:30:09
【问题描述】:
我在混合流程中针对 IdentityServer3 使用 Microsoft 的 OpenIdConnectAuthenticationMiddleware。我将跳过 IdentityServer3 设置代码(因为我认为那里没有问题),但这是依赖方启动代码:
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies"
});
var options = new OpenIdConnectAuthenticationOptions
{
Authority = "https://localhost:44300/",
ClientId = "hybridclient",
ClientSecret = "secret",
RedirectUri = "https://localhost:44301/",
ResponseType = "code id_token",
SignInAsAuthenticationType = "Cookies",
Scope = "openid profile"
};
app.UseOpenIdConnectAuthentication(options);
我注意到,当 IdentityServer3 使用过期证书进行签名时——它允许,但尽职尽责地记录为警告——证书上的过期被忽略并允许身份验证。这似乎是错误的。
我不知道这是谁的责任(OpenIdConnectAuthenticationMiddleware?ADAL?)因为在我看来,当签名证书过期时,身份验证很容易失败。我一直查看代码,从 Katana 一直到 ADAL 中的 JwtSecurityTokenHandler,但看不到已检查过期。
我可以在TokenValidationParameters.IssuerSigningKeyResolver 或OpenIdConnectAuthenticationNotifications 上的SecurityTokenValidated 通知中自己滚动一些东西,但这似乎应该是内置的。
有没有办法让 Microsoft OIDC 中间件验证签名证书过期?还是我错过了什么?
更新:鉴于 Brent 的回答,这显然是 gap in the functionality of JwtSecurityTokenHandler that Microsoft would like to fill。我只能说我目前看到了这个,安装了 v4.0.0(因为它是 Microsoft.Owin.Security.OpenIdConnect NuGet 包的依赖项)。
【问题讨论】:
标签: openid-connect katana adal identityserver3