IdentityServer4 OpenIdConnectAuthentication 或 IdentityServerAuthentication

IdentityServer4 OpenIdConnectAuthentication or IdentityServerAuthentication

为 ASP WebAPI/MVC 配置 IdentityServer4 时,我可以选择使用

在我看来,它做同样的事情。为什么我应该选择身份服务器选项而不是 openidconnect?

每一个什么时候最适用,为什么?

app.UseOpenIdConnectAuthentication

它实现了一个中间件来使用 OIC 流,无论您的服务器权限如何。

查看这些链接:

app.UseIdentityServerAuthentication

在这种情况下,配置更具体以使用 IdendityServer4 工作流

差异?

第一个更通用,而第二个更具体。

在 API (MVC Web API) 应用程序中,您应该调用

app.UseIdentityServerAuthentication

参见 IdentityServer4 API documentation

Our authentication middleware serves the same purpose as the app.UseJwtBearerAuthentication middleware (in fact it uses the Microsoft JWT middleware internally), but adds a couple of additional features:

  • support for both JWTs and reference tokens
  • extensible caching for reference tokens
  • unified configuration model
  • scope validation

在 Web 客户端 (MVC Web) 中,您应该调用

app.UseOpenIdConnectAuthentication

IdentityServer4 "Creating an MVC client" documentation