我应该能够使用以下内容。
services.AddAuthentication() .AddIdentityServerJwt();
这不起作用,因为AddIdentityServerJwt
似乎不存在。另外,我不确定此时此刻我是否想与 IdentityServer 携手并进。
在以前的版本中,我会声明一个默认方案并在 Startup.cs 文件中配置令牌验证。然而现在,似乎所有的奶酪都被转移到了 Core 3 中。
我应该如何使用 JWT 配置(尽可能简单的)安全性并(最好)避免 Identity Server?
public void ConfigureServices(IServiceCollection services)
{
...
services.AddAuthentication();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
...
//app.UseRouting();
app.UseAuthentication();
//app.UseAuthorization();
//app.UseEndpoints(e => e.MapControllers());
}
这会在 Swagger 中产生以下错误的不同变体。
未指定authenticationScheme,并且未找到DefaultChallengeScheme。
人到中年有点甜
相关分类