Asp.net core ASP.NET Core 3中的app.UseOpenIdConnectAuthentication()和OpenIdConnectMiddleware在哪里?

Asp.net core ASP.NET Core 3中的app.UseOpenIdConnectAuthentication()和OpenIdConnectMiddleware在哪里?,asp.net-core,Asp.net Core,上下文 我正在尝试迁移使用app.UseOpenIdConnectAuthentication()的应用程序,但在包Microsoft.AspNetCore.Authentication.OpenIdConnect 此扩展方法的实际源代码使用类OpenIdConnectMiddleware,它似乎也消失了 问题 如何迁移此应用程序 将启动文件更改为以下示例 public void ConfigureServices(IServiceCollection services) {

上下文

我正在尝试迁移使用
app.UseOpenIdConnectAuthentication()
的应用程序,但在包
Microsoft.AspNetCore.Authentication.OpenIdConnect
此扩展方法的实际源代码使用类
OpenIdConnectMiddleware
,它似乎也消失了

问题


如何迁移此应用程序

将启动文件更改为以下示例


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");
                });
        }

将启动文件更改为下面的示例


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");
                });
        }

这在ASP.NET Core 2.0的发行版中被弃用。请看。Kirk,thx,我的错。如果你把这个作为答案发布,我可以接受。这在ASP.NET Core 2.0版本中被弃用了。看,柯克,谢谢,我的错,如果你把这个作为答案,我可以接受。