A set of libraries to easily integrate and extend authentication in ASP.NET Core projects, using ASP.NET Core Identity.
$ dotnet add package Identity.Module.APIA set of libraries to easily integrate and extend authentication in ASP.NET Core projects, using ASP.NET Core Identity.
MinimalApi.Identity is a dynamic and modular identity manager for managing users, roles, claims and more for access control in Asp.Net Mvc Core and Web API, using .NET 8 Minimal API, Entity Framework Core and relational database (of your choice).
[!IMPORTANT] This library is still under development of new implementations and in the process of creating the related documentation.
appsettings.json to suit your application's needs.The library is available on NuGet, just search for Identity.Module.API in the Package Manager GUI or run the following command in the .NET CLI:
dotnet add package Identity.Module.API
The configuration can be completely managed by adding this section to the appsettings.json file:
[!WARNING] The library is still under development, so the configuration may change in future updates.
[!NOTE] For migrations you can use a specific project to add to your solution, then configuring the assembly in ConnectionStrings:MigrationsAssembly, otherwise leave it blank and the assembly containing the Program.cs class will be used.
"Kestrel": {
"Limits": {
"MaxRequestBodySize": 5242880
}
},
"ConnectionStrings": {
"DatabaseType": "sqlserver", // Options: "sqlserver"
"SQLServer": "Data Source=[HOSTNAME];Initial Catalog=IdentityManager;User ID=[USERNAME];Password=[PASSWORD];Encrypt=False",
"MigrationsAssembly": "MinimalApi.Identity.Migrations.SQLServer"
},
"JwtOptions": {
"SchemaName": "Bearer",
"Issuer": "[ISSUER]",
"Audience": "[AUDIENCE]",
"SecurityKey": "[SECURITY-KEY]", // Must be 512 characters long
"ClockSkew": "00:05:00", // Default: 5 minutes
"AccessTokenExpirationMinutes": 60, // 60 minutes
"RefreshTokenExpirationMinutes": 60, // 60 minutes
"RequireUniqueEmail": true,
"RequireDigit": true,
"RequiredLength": 8,
"RequireUppercase": true,
"RequireLowercase": true,
"RequireNonAlphanumeric": true,
"RequiredUniqueChars": 4,
"RequireConfirmedEmail": true,
"MaxFailedAccessAttempts": 3,
"AllowedForNewUsers": true,
"DefaultLockoutTimeSpan": "00:05:00" // 5 minutes
},
"SmtpOptions": {
"Host": "smtp.example.org",
"Port": 25,
"Security": "StartTls",
"Username": "Username del server SMTP",
"Password": "Password del server SMTP",
"Sender": "MyApplication <noreply@example.org>",
"MaxRetryAttempts": 10
},
"ApplicationOptions": {
"ErrorResponseFormat": "List"
},
"FeatureFlagsOptions": {
"EnabledFeatureLicense": true,
"EnabledFeatureModule": true
},
"HostedServiceOptions": {
"IntervalAuthPolicyUpdaterMinutes": 5,
"IntervalEmailSenderMinutes": 1
},
"UsersOptions": {
"AssignAdminEmail": "admin@example.org",
"AssignAdminPassword": "StrongPassword",
"PasswordExpirationDays": 90
},
"ValidationOptions": {
"MinLength": 3,
"MaxLength": 50,
"MinLengthDescription": 5,
"MaxLengthDescription": 100
}The library uses Entity Framework Core to manage the database.
The connection string is configured in the ConnectionStrings section of the appsettings.json file.
ConnectionStrings:DatabaseType (supported values: sqlserver)After setting the type of database you want to use, modify the corresponding connection string.
[!TIP] To update the database schema you need to create migrations, they will be applied automatically at the next application startup.
To create database migrations select MinimalApi.Identity.Core as the default project from the drop-down menu in the Package Manager Console
and run the command: Add-Migration MIGRATION-NAME
[!NOTE] if you use a separate project for migrations (It is recommended to add a reference in the project name to the database used, in this case it is SQL Server), make sure to set the
-Projectparameter to the name of that project.
Example: Add-Migration InitialMigration -Project MinimalApi.Identity.Migrations.SQLServer
🚧 coming soon
[!WARNING] The library is still under development, so the Program.cs configuration may change in future updates.
An example configuration of the Program.cs class is available here
This library currently supports the following authentication types:
🚧 coming soon
See the documentation for a list of all available endpoints.
| Name | Type | Version |
|---|---|---|
| Identity.Module.API | Main | |
| Identity.Module.AccountManager | Dependence | Coming soon |
| Identity.Module.ClaimsManager | Dependence | Coming soon |
| Identity.Module.Core | Dependence | |
| Identity.Module.EmailManager | Dependence | |
| Identity.Module.Licenses | Dependence | |
| Identity.Module.ModuleManager | Dependence | Coming soon |
| Identity.Module.PolicyManager | Dependence | |
| Identity.Module.ProfileManager | Dependence | Coming soon |
| Identity.Module.RolesManager | Dependence | Coming soon |
| Identity.Module.Results | Dependence | Coming soon |
This project is licensed under the MIT License - see the LICENSE file for details.
Don't forget that if you find this project useful, put a ⭐ on GitHub to show your support and help others discover it.
The project is constantly evolving. Contributions are always welcome. Feel free to report issues and submit pull requests to the repository, following the steps below:
If you have any questions or need help, read here to find out what to do.