DavidGroup.Core.Identity
1.0.0-develop.2
See the version list below for details.
dotnet add package DavidGroup.Core.Identity --version 1.0.0-develop.2
NuGet\Install-Package DavidGroup.Core.Identity -Version 1.0.0-develop.2
<PackageReference Include="DavidGroup.Core.Identity" Version="1.0.0-develop.2" />
<PackageVersion Include="DavidGroup.Core.Identity" Version="1.0.0-develop.2" />
<PackageReference Include="DavidGroup.Core.Identity" />
paket add DavidGroup.Core.Identity --version 1.0.0-develop.2
#r "nuget: DavidGroup.Core.Identity, 1.0.0-develop.2"
#:package DavidGroup.Core.Identity@1.0.0-develop.2
#addin nuget:?package=DavidGroup.Core.Identity&version=1.0.0-develop.2&prerelease
#tool nuget:?package=DavidGroup.Core.Identity&version=1.0.0-develop.2&prerelease
DavidGroup.Core.Identity
Simplifies authentication and authorization in .NET web APIs with ready-to-use features and helpers.
🚀 Getting Started
Install NuGet Package
Using the .NET CLI:
dotnet add package DavidGroup.Core.Identity
Or via the Package Manager Console:
Install-Package DavidGroup.Core.Identity
How to use it?
Feel free to explore the samples to find practical examples for each feature. New samples are added continuously as more features are developed.
📦 Key Features
How to add Identity Authentication & Authorization
Program.cs
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
builder.Services.AddIdentityAuthentication(builder.Configuration);
builder.Services.AddAuthorization();
builder.Services.AddControllersWithIdentity();
WebApplication app = builder.Build();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.Run();
appsettings.json
{
"JwtOptions": {
"Issuer": "https://auth.example.com/",
"Audience": "https://example.com/",
"SecretKey": "a-string-secret-at-least-256-bits-long"
}
}
Attributes
[Authorize]
[ApiController]
[Route("api/[controller]")]
public class BookstoreController : ControllerBase
{
private readonly string[] _books =
[
"The Shining",
"Needful Things",
"IT",
"Misery",
"Doctor Sleep",
"Cell",
"The Institute",
"Mr. Mercedes",
"The Green Mile"
];
[LicenseAndPrivacyPolicy("v1.2", "v1.5")] // Requires license and privacy policy to be accepted
[HasPermission(Permissions.Books.Read)] // Requires defined permission
[FreshSession(60)] // Session must be new and within specified seconds
[EmailConfirmed] // Email address must be confirmed
[PhoneConfirmed] // Phone number must be confirmed
[HttpGet("all")]
public IActionResult All()
{
return Ok(_books);
}
}
IdentityController
[ApiController]
[Route("api/[controller]")]
public class LoginController(IOptions<JwtOptions> jwtOptions) : IdentityController
{
[Authorize]
[HttpGet("who-am-i")]
public IActionResult WhoAmI()
{
if (!TryGetClaim(DavidGroupClaimTypes.AuthTime, out long authTimeInUnixSeconds))
return NotFound();
return Ok(new
{
Id = GetRequiredClaim<Guid>(JwtRegisteredClaimNames.Sub),
Email = GetRequiredClaim(DavidGroupClaimTypes.Email),
AuthTime = DateTimeOffset.FromUnixTimeSeconds(authTimeInUnixSeconds).ToLocalTime()
});
}
}
🤝 Contributing
Found a bug? Have an idea? Want to contribute?
- Submit an issue: https://github.com/david-group-solutions/identity/issues
- Create a pull request: https://github.com/david-group-solutions/identity/pulls
Contributions of any size are appreciated!
📝 License
Distributed under the MIT license. See License for more information.
Copyright © 2025-2026 David Khachatryan (David Group Solutions)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 10.0.9)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.9)
- Microsoft.OpenApi (>= 2.10.0)
- Scrutor (>= 7.0.0)
- Swashbuckle.AspNetCore.SwaggerGen (>= 10.2.3)
-
net8.0
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 8.0.28)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.OpenApi (>= 2.10.0)
- Scrutor (>= 6.1.0)
- Swashbuckle.AspNetCore.SwaggerGen (>= 10.2.3)
-
net9.0
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 9.0.17)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.17)
- Microsoft.OpenApi (>= 2.10.0)
- Scrutor (>= 6.1.0)
- Swashbuckle.AspNetCore.SwaggerGen (>= 10.2.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1 | 111 | 9/3/2026 |
| 1.0.1-develop.3 | 58 | 9/3/2026 |
| 1.0.0 | 125 | 7/14/2026 |
| 1.0.0-develop.2 | 67 | 7/14/2026 |