From b5293bde08ae00ed23d23c0e90f682f09fd2da8a Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Mon, 26 Aug 2024 15:26:43 -0700 Subject: [PATCH 1/8] Add PACKAGE.md --- .../EntityFrameworkCore/src/PACKAGE.md | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/Identity/EntityFrameworkCore/src/PACKAGE.md diff --git a/src/Identity/EntityFrameworkCore/src/PACKAGE.md b/src/Identity/EntityFrameworkCore/src/PACKAGE.md new file mode 100644 index 000000000000..dad8ec256e77 --- /dev/null +++ b/src/Identity/EntityFrameworkCore/src/PACKAGE.md @@ -0,0 +1,58 @@ +## About + +`Microsoft.AspNetCore.Identity.EntityFrameworkCore` utilizes Entity Framework Core to provide functionality enabling the storage of user, role, and other identity-related data in a database. + +## Key Features + +* Provides user and role management +* Enables secure authentication and authorization mechanisms +* Allows storage and validatation of user passwords using hashing +* Implements sending email confirmation links for user account validation +* Provides two-factor authentication to provide an extra layer of security +* Protects against brute-force attacks by locking out user accounts after multiple failed login attempts +* Uses claims to define fine-grained access control policies +* Seamlessly integrates with Entity Framework Core for data storage and retrieval + +## How to use + +To use `Microsoft.AspNetCore.Identity.EntityFrameworkCore`, follow these steps: + +### Installation + +```sh +dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore +``` + +### Configuration + +After installing the package, you need to configure it in your `Startup.cs` file. Add the following code to the `ConfigureServices` method: + +Add the following code to the `Program.cs` of your ASP.NET Core app: + +```csharp +builder.Services.AddDbContext(options => + options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"))); + +builder.Services.AddDefaultIdentity() + .AddEntityFrameworkStores(); +``` + +Make sure to replace `ApplicationDbContext` with your own database context class and `DefaultConnection` with your own connection string. + +## Main Types + +The main types provided by `Microsoft.AspNetCore.Identity.EntityFrameworkCore` include: + +* `IdentityDbContext`: Provides the database context for storing and managing user, role, and other identity-related data +* `IdentityUserContext`: Provides methods and properties for querying and manipulating user information +* `RoleStore`: Provides methods for creating, updating, and deleting roles, as well as querying and managing role-related data +* `UserStore`: Provides methods for creating, updating, and deleting users, as well as querying and managing user-related data +* `UserOnlyStore`: Provides methods for creating, updating, and deleting users, as well as querying and managing user-related data for users without roles + +## Additional Documentation + +For additional documentation and examples, refer to the [official documentation](https://learn.microsoft.com/aspnet/core/security/authentication/identity) on ASP.NET Core Identity. + +## Feedback & Contributing + +`Microsoft.AspNetCore.Identity.EntityFrameworkCore` is released as open-source under the [MIT license](https://licenses.nuget.org/MIT). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/aspnetcore). From 5a73cdfe2e6d08fb2651d62f9193032ebab452d6 Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Mon, 26 Aug 2024 16:24:45 -0700 Subject: [PATCH 2/8] Update PACKAGE.md --- src/Identity/EntityFrameworkCore/src/PACKAGE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Identity/EntityFrameworkCore/src/PACKAGE.md b/src/Identity/EntityFrameworkCore/src/PACKAGE.md index dad8ec256e77..b57b2e6a3ee2 100644 --- a/src/Identity/EntityFrameworkCore/src/PACKAGE.md +++ b/src/Identity/EntityFrameworkCore/src/PACKAGE.md @@ -13,7 +13,7 @@ * Uses claims to define fine-grained access control policies * Seamlessly integrates with Entity Framework Core for data storage and retrieval -## How to use +## How to Use To use `Microsoft.AspNetCore.Identity.EntityFrameworkCore`, follow these steps: From 80521b70d842e54878294e5dc8a580abb01ceb22 Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Wed, 28 Aug 2024 15:04:53 -0700 Subject: [PATCH 3/8] Update PACKAGE.md --- src/Identity/EntityFrameworkCore/src/PACKAGE.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Identity/EntityFrameworkCore/src/PACKAGE.md b/src/Identity/EntityFrameworkCore/src/PACKAGE.md index b57b2e6a3ee2..ba70fbb851c6 100644 --- a/src/Identity/EntityFrameworkCore/src/PACKAGE.md +++ b/src/Identity/EntityFrameworkCore/src/PACKAGE.md @@ -25,8 +25,6 @@ dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore ### Configuration -After installing the package, you need to configure it in your `Startup.cs` file. Add the following code to the `ConfigureServices` method: - Add the following code to the `Program.cs` of your ASP.NET Core app: ```csharp From e736271a3750eaf54ac6a6b1c712196dc11ca762 Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Thu, 29 Aug 2024 16:41:57 -0700 Subject: [PATCH 4/8] Update src/Identity/EntityFrameworkCore/src/PACKAGE.md Co-authored-by: Stephen Halter --- src/Identity/EntityFrameworkCore/src/PACKAGE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Identity/EntityFrameworkCore/src/PACKAGE.md b/src/Identity/EntityFrameworkCore/src/PACKAGE.md index ba70fbb851c6..e96f3ef304c0 100644 --- a/src/Identity/EntityFrameworkCore/src/PACKAGE.md +++ b/src/Identity/EntityFrameworkCore/src/PACKAGE.md @@ -31,7 +31,7 @@ Add the following code to the `Program.cs` of your ASP.NET Core app: builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"))); -builder.Services.AddDefaultIdentity() +builder.Services.AddDefaultIdentity() .AddEntityFrameworkStores(); ``` From 7df9a08167aac6786fd3253550e9da57f5efe40f Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Thu, 29 Aug 2024 16:42:02 -0700 Subject: [PATCH 5/8] Update src/Identity/EntityFrameworkCore/src/PACKAGE.md Co-authored-by: Stephen Halter --- src/Identity/EntityFrameworkCore/src/PACKAGE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Identity/EntityFrameworkCore/src/PACKAGE.md b/src/Identity/EntityFrameworkCore/src/PACKAGE.md index e96f3ef304c0..2ea7cfb970d8 100644 --- a/src/Identity/EntityFrameworkCore/src/PACKAGE.md +++ b/src/Identity/EntityFrameworkCore/src/PACKAGE.md @@ -7,7 +7,7 @@ * Provides user and role management * Enables secure authentication and authorization mechanisms * Allows storage and validatation of user passwords using hashing -* Implements sending email confirmation links for user account validation +* Tracks email confirmation for user account validation * Provides two-factor authentication to provide an extra layer of security * Protects against brute-force attacks by locking out user accounts after multiple failed login attempts * Uses claims to define fine-grained access control policies From 9c108520d823c001cfaae3060e4f1e21124e65bf Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Thu, 29 Aug 2024 16:42:08 -0700 Subject: [PATCH 6/8] Update src/Identity/EntityFrameworkCore/src/PACKAGE.md Co-authored-by: Stephen Halter --- src/Identity/EntityFrameworkCore/src/PACKAGE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Identity/EntityFrameworkCore/src/PACKAGE.md b/src/Identity/EntityFrameworkCore/src/PACKAGE.md index 2ea7cfb970d8..90ce03ed8f27 100644 --- a/src/Identity/EntityFrameworkCore/src/PACKAGE.md +++ b/src/Identity/EntityFrameworkCore/src/PACKAGE.md @@ -8,7 +8,7 @@ * Enables secure authentication and authorization mechanisms * Allows storage and validatation of user passwords using hashing * Tracks email confirmation for user account validation -* Provides two-factor authentication to provide an extra layer of security +* Tracks two-factor authentication to provide an extra layer of security * Protects against brute-force attacks by locking out user accounts after multiple failed login attempts * Uses claims to define fine-grained access control policies * Seamlessly integrates with Entity Framework Core for data storage and retrieval From 40b9c716fd8ac13c43de7bf9ba8f3103ae3bf682 Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Thu, 29 Aug 2024 16:42:16 -0700 Subject: [PATCH 7/8] Update src/Identity/EntityFrameworkCore/src/PACKAGE.md Co-authored-by: Stephen Halter --- src/Identity/EntityFrameworkCore/src/PACKAGE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Identity/EntityFrameworkCore/src/PACKAGE.md b/src/Identity/EntityFrameworkCore/src/PACKAGE.md index 90ce03ed8f27..65c8ed67c959 100644 --- a/src/Identity/EntityFrameworkCore/src/PACKAGE.md +++ b/src/Identity/EntityFrameworkCore/src/PACKAGE.md @@ -9,7 +9,7 @@ * Allows storage and validatation of user passwords using hashing * Tracks email confirmation for user account validation * Tracks two-factor authentication to provide an extra layer of security -* Protects against brute-force attacks by locking out user accounts after multiple failed login attempts +* Tracks failed login attempts to help protect against brute-force attacks enabling locking out user accounts after multiple failed login attempts * Uses claims to define fine-grained access control policies * Seamlessly integrates with Entity Framework Core for data storage and retrieval From 2d0b9d7d1d88499391a55a9df2c0028a50bfaaca Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Thu, 29 Aug 2024 16:42:24 -0700 Subject: [PATCH 8/8] Update src/Identity/EntityFrameworkCore/src/PACKAGE.md Co-authored-by: Stephen Halter --- src/Identity/EntityFrameworkCore/src/PACKAGE.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Identity/EntityFrameworkCore/src/PACKAGE.md b/src/Identity/EntityFrameworkCore/src/PACKAGE.md index 65c8ed67c959..ca45a656f9b1 100644 --- a/src/Identity/EntityFrameworkCore/src/PACKAGE.md +++ b/src/Identity/EntityFrameworkCore/src/PACKAGE.md @@ -35,7 +35,9 @@ builder.Services.AddDefaultIdentity() .AddEntityFrameworkStores(); ``` -Make sure to replace `ApplicationDbContext` with your own database context class and `DefaultConnection` with your own connection string. +You can replace `ApplicationDbContext` with your own database context class derived from `IdentityDbContext` and `ApplicationUser` with your own user class containing additional properties derived from `IdentityUser`. + +Make sure to [configure the connection string](https://learn.microsoft.com/ef/core/miscellaneous/connection-strings#aspnet-core) via "ConnectionStrings:DefaultConnection" (or whatever you rename it to) so it can connect to your database. ## Main Types