Skip to content
58 changes: 58 additions & 0 deletions src/Identity/EntityFrameworkCore/src/PACKAGE.md
Original file line number Diff line number Diff line change
@@ -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<ApplicationDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));

builder.Services.AddDefaultIdentity<IdentityUser>()
.AddEntityFrameworkStores<ApplicationDbContext>();
```

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).