Pavas.Runtime.IdentityContext
1.0.0
dotnet add package Pavas.Runtime.IdentityContext --version 1.0.0
NuGet\Install-Package Pavas.Runtime.IdentityContext -Version 1.0.0
<PackageReference Include="Pavas.Runtime.IdentityContext" Version="1.0.0" />
paket add Pavas.Runtime.IdentityContext --version 1.0.0
#r "nuget: Pavas.Runtime.IdentityContext, 1.0.0"
// Install Pavas.Runtime.IdentityContext as a Cake Addin #addin nuget:?package=Pavas.Runtime.IdentityContext&version=1.0.0 // Install Pavas.Runtime.IdentityContext as a Cake Tool #tool nuget:?package=Pavas.Runtime.IdentityContext&version=1.0.0
Pavas.Runtime.IdentityContext
Pavas.Runtime.IdentityContext is a library designed to manage user identity, including authentication and authorization, within ASP.NET Core applications. It centralizes user-related information such as roles, claims, and other identity data, making it easier to access and manage across the application.
Features
- Centralized Identity Management: Provides an
IdentityContext
class to encapsulate user identity information. - Middleware Support: Easily integrate identity management into the request pipeline using the
IdentityContextMiddleware
. - Claims and Roles Handling: Simplifies the handling of user claims, roles, and other identity attributes.
Installation
To use this library, include it in your project through dependency injection.
Usage
Setting Up the Identity Context
Define the identity context when create a jwt token:
var identityContext = new IdentityContext { Identifier = "1234567890", Username = "John Doe", Email = "john.doe@example.com", Country = "US", Gender = "Male", PostalCode = "12345", AuthenticationType = "Custom", IsAuthenticated = true, IpAddress = "127.0.0.1", Roles = ["Admin", "User"], Claims = [new Claim("custom-claim-type", "custom-claim-value")] };
Inject the context into the service during application setup:
builder.Services.AddIdentityContext();
Add the middleware to the request pipeline:
app.UseIdentityContextMiddleware();
License
This project is licensed under the MIT License.
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. |
-
net8.0
- Microsoft.AspNetCore.Http (>= 2.1.34)
- Pavas.Patterns.Context (>= 1.0.4)
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.0 | 132 | 8/25/2024 |