Asya.JwtManager 1.0.1-rc

This is a prerelease version of Asya.JwtManager.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Asya.JwtManager --version 1.0.1-rc                
NuGet\Install-Package Asya.JwtManager -Version 1.0.1-rc                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Asya.JwtManager" Version="1.0.1-rc" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Asya.JwtManager --version 1.0.1-rc                
#r "nuget: Asya.JwtManager, 1.0.1-rc"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Asya.JwtManager as a Cake Addin
#addin nuget:?package=Asya.JwtManager&version=1.0.1-rc&prerelease

// Install Asya.JwtManager as a Cake Tool
#tool nuget:?package=Asya.JwtManager&version=1.0.1-rc&prerelease                

Asya JWT Manager

a lightweight JWT authentication manager that's allow you to work with JWT token easily and safe

you can register the package on the startup class as following in Configure method call UseAsyaJwtServices(configuration); and you should pass the configuration instance on this function then you must adding the JWT settings in you appsettings.json file as following

Property Description Default Value
Secret the secret key for you token generator none
Issuer the token issuer none
Audience the token audience none
ValidateIssuer should manager validate issuer false
ValidateAudience should manager validate audience false
ValidateLifeTime the token validation life time in minutes none
ValidateIssuerSigningKey should token validate the issuer signing key false
AccessTokenExpiration the access token expiring life time in minutes none
RefreshTokenExpiration the refresh token expiring life time in minutes none
RemoveCachedRefreshTokensEvery the automation remover background process for expired tokens in minutes 1
ClockSkew the token manger ClockSkew value 1

then you have a strong interface with a bunch of ready to use functions as following

AuthenticationResult GenerateTokens(string email, Claim[] claims, DateTime now); AuthenticationResult Refresh(string refreshToken, string accessToken, DateTime now); void RemoveExpiredRefreshTokens(DateTime now); void RemoveRefreshTokenByUserName(string userName); (ClaimsPrincipal, JwtSecurityToken) DecodeJwtToken(string token);

the AuthenticationResult should return the following

Proeprty Type
AccessToken string
RefreshToken RefreshToken

and the RefreshToken

Proeprty Type
UserName string
TokenString string
ExpireAt datetime
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.2-rc 222 9/22/2021
1.0.1-rc 176 9/22/2021
1.0.0 450 9/20/2021

Initializing of the JWT manager