语境
我正在尝试迁移一个使用app.UseOpenIdConnectAuthentication()但在包中找不到此扩展方法的应用程序此扩展方法Microsoft.AspNetCore.Authentication.OpenIdConnect
的实际来源使用的类OpenIdConnectMiddleware似乎也已消失。
题
如何迁移此应用程序?
小智 7
将您的启动文件更改为以下示例
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
options.DefaultAuthenticateScheme = "oidc";
options.DefaultSignInScheme = "Cookies";
})
.AddCookie()
.AddOpenIdConnect(options =>
{
options.Authority = "http://localhost:5000";
options.RequireHttpsMetadata = false;
options.ClientId = "mvc-client";
options.ClientSecret = "secret-key";
options.ResponseType = "id_token token";
options.Scope.Add("openid");
options.Scope.Add("profile");
options.Scope.Add("email");
});
}
| 归档时间: |
|
| 查看次数: |
2231 次 |
| 最近记录: |