.net core identity 2.1 role authorize not working

后端 未结 3 521
忘了有多久
忘了有多久 2020-12-10 13:23

I\'ve implemented role based auth several times pre 2.1. Followed the steps to scaffold the new 2.1 identities.

I extended the IdentityUser model to add additional f

3条回答
  •  醉话见心
    2020-12-10 13:33

    In my case of ASP.NET Core 3 (preview) + Angular, solution was in AddAuthentication

    services.AddDefaultIdentity()
        .AddRoles()
        .AddRoleManager>()
        .AddEntityFrameworkStores();
    
    services.AddAuthentication(options =>
    {
        options.DefaultAuthenticateScheme = IdentityConstants.ApplicationScheme;
        options.DefaultChallengeScheme = IdentityConstants.ApplicationScheme;
        options.DefaultSignInScheme = IdentityConstants.ExternalScheme;
    });
    

提交回复
热议问题