没有将IAuthenticationSignInHandler配置为处理以下方案的登录:Identity.Application

时间:2019-01-25 16:54:02

标签: asp.net-core-2.1 asp.net-core-identity

我试图更改身份的默认ID,但确实更改了ID,而不是使用AddIdentity,而是使用AddIdenityCore并指定了 默认身份验证方案以及默认登录和注销方案

但是我得到了这个消息,从该注册方法注册和登录时没有配置IAuthenticationSignInHandler错误。

等待_signInManager.SignInAsync(user,isPersistent:false); ->发生错误

 IdentityBuilder builder = services.AddIdentityCore<ApplicationUser>(options =>
        {
            options.Lockout.MaxFailedAccessAttempts = 3;
            options.SignIn.RequireConfirmedEmail = true;
            options.User.RequireUniqueEmail = true;
        });

        builder = new IdentityBuilder(builder.UserType, typeof(ApplicationRole), builder.Services);
        builder.AddEntityFrameworkStores<ApplicationDbContext>()
          .AddRoleValidator<RoleValidator<ApplicationRole>>()
          .AddRoleManager<RoleManager<ApplicationRole>>()
          .AddSignInManager<SignInManager<ApplicationUser>>()
          .AddDefaultTokenProviders();

        services.AddAuthentication(options =>
        {
            options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
            options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
            options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
            options.DefaultSignOutScheme = IdentityConstants.ExternalScheme;
        }).AddCookie(CookieAuthenticationDefaults.AuthenticationScheme,
          options =>
          {
              options.Cookie.HttpOnly = true;
              options.LoginPath = new PathString("/user/account/login");
              options.AccessDeniedPath = new PathString("/user/account/accessdenied");
          });

0 个答案:

没有答案