

ASP.NET Core Identity AddDefaultIdentity vs AddIdentity
source link: https://www.stevefenton.co.uk/2021/11/asp-net-core-identity-adddefaultidentity-vs-addidentity/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

ASP.NET Core Identity AddDefaultIdentity vs AddIdentity
The short version on the difference between AddDefaultIdentity
and AddIdentity
is the default part adds in all the built-in controllers and views for logging in, recovering accounts, and password resets but doesn’t add roles. You can, though, add roles to AddDefaultIdentity
to get all the things.
AddDefaultIdentity
This examples shows how to add the default version with AddDefaultIdentity
but also adds roles on using AddRoles<IdentityRole>
. This achieves “ticks in all the boxes” on the matrix shown above.
services .AddDefaultIdentity<IdentityUser>(options => { // options are set here }) .AddRoles<IdentityRole>() .AddEntityFrameworkStores<ApplicationDbContext>();
With this code you get the tables, the roles, and the built in pages.
AddIdentity
This example shows the AddIdentity
version. You get the tables and roles for free, but you need to implement your own pages (which may be desirable, for example if you want full control over the experience for logins and registrations).
services .AddIdentity<IdentityUser>(options => { // options are set here }) .AddEntityFrameworkStores<ApplicationDbContext>();
Recommend
-
14
Angular Authentication Functionality with ASP.NET Core Identity Posted by Marinko Spasojevic | Updated Date Dec 16, 2020 |
-
16
Stub User.Identity.IsAuthenticated in ASP Core I’m writing this article strictly because google do not have any obvious solutions in the hope it will be indexed and presented for fellow devs. We use identity serv...
-
17
Angular Email Confirmation with ASP.NET Core Identity Posted by Marinko Spasojevic | Updated Date Dec 21, 2020 |
-
9
Microsoft Identity Claims in ASP.NET Core: OperationAuthorization Requirement I didn't know this existed until a reader made me aware of it. Today, we update the menu systems with Microsoft Identity using the OperationAuthorizationR...
-
12
ASP.NET Core and Blazor Identity and State 16 Mar 2022 Over the past several weeks I’ve been wrestling with the way in which ASP.NET Core (aspnetcore) and server-side Blazor manage things like context, identity, and state....
-
8
Using Oracle Database with ASP.NET Core IdentityASP.NET Core Identity is a .NET interface that supports user and role authenticati...
-
8
Introduction to Identity Server with ASP.Net Core Identity Importance of security On every platform security is important, and especially tru...
-
6
Improvements to auth and identity in ASP.NET Core 8 Jeremy Likness...
-
7
ASP.NET Core Identity 系列之三 精选 原创 桂素伟 2023-08-06 14:22:40
-
11
ASP.NET Core Identity 系列之二 精选 原创 桂素伟 2023-08-06 13:54:39
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK