ASP.NET Core Identity 及 Authentication 源代碼


 學習: asp.net core 3.x Identity  : https://www.cnblogs.com/jionsoft/p/12326788.html

     《asp.net core 3.x 身份驗證-1涉及到的概念》、《asp.net core 3.x 身份驗證-2啟動階段的配置》、《asp.net core 3.x 身份驗證-3cookie身份驗證原理

          《ASP.NET Core Identity 實戰(1、2、3)》、《ASP.NET Core 之 Identity 入門(一)(二)

           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 源

      IdentityUI  源代碼所在:  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

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

一文章解釋: AddIdentity與AddIdentityCore 、AddDefaultIdentity  的區別 : https://www.it1352.com/1768289.html

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM