学习: https://www.cnblogs.com/jionsoft/p/12326788.html

     《asp.net core 3.x 身份验证-3cookie身份验证原理

          《ASP.NET Core Identity 实战(1、2、3)》、《(二)

           https://github.com/dotnetcore     《ASP.NET Core 运行原理解剖[5]:Authentication

------------------------------------------------------------------------------------------------------------------------------------

Aspnet Core 的启动类 Startup 配置有下列代码:查看源代码  dotnet/aspnetcore

以及官方的文档解释  https://docs.microsoft.com/zh-cn/aspnet/core/security/authentication/identity?view=aspnetcore-3.1&tabs=visual-studio 

扩展方法定义:AddIdentity<TUser,TRole>(IServiceCollection)  ,  可以只有用户 AddIdentityCore<TUser>(IServiceCollection),角色另加。

                  或   AddIdentity<TUser,TRole>(IServiceCollection, Action<IdentityOptions>)   或   AddIdentityCore<TUser>(IServiceCollection, Action<IdentityOptions>)

 

// AddIdentity 源代码: https://github.com/dotnet/aspnetcore/blob/v3.1.2/src/Identity/Extensions.Core/src/IdentityServiceCollectionExtensions.cs  ( 扩展方法:AddIdentityCore<TUser> 

      另一个扩展(区别?):https://github.com/dotnet/aspnetcore/blob/v3.1.2/src/Identity/Core/src/IdentityServiceCollectionExtensions.cs   ( 扩展方法:AddIdentity<TUser, TRole> 

services.AddIdentity<ApplicationUser, IdentityRole<Guid>>()
             .AddRoles<IdentityRole<Guid>>()
             .AddEntityFrameworkStores<ApplicationDbContext>()
             .AddDefaultTokenProviders();

services.AddDefaultIdentity 是在 ASP.NET Core 2.1 中引入的。 调用 AddDefaultIdentity 类似于调用以下内容:

AddDefaultIdentity 源。

https://github.com/dotnet/aspnetcore/tree/release/3.1/src/Identity/UI/src   

                                        https://github.com/dotnet/aspnetcore/tree/release/3.1/src/Identity/UI/src/Areas/Identity/Pages/V4

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

https://www.it1352.com/1768289.html

 

相关文章: