EasyRefreshToken 7.1.2
See the version list below for details.
dotnet add package EasyRefreshToken --version 7.1.2
NuGet\Install-Package EasyRefreshToken -Version 7.1.2
<PackageReference Include="EasyRefreshToken" Version="7.1.2" />
paket add EasyRefreshToken --version 7.1.2
#r "nuget: EasyRefreshToken, 7.1.2"
// Install EasyRefreshToken as a Cake Addin #addin nuget:?package=EasyRefreshToken&version=7.1.2 // Install EasyRefreshToken as a Cake Tool #tool nuget:?package=EasyRefreshToken&version=7.1.2
EasyRefreshToken 1.2
<table> <tbody>
<tr> <td> <a href="https://www.nuget.org/packages/EasyRefreshToken/"> <img alt="Nuget" src="https://img.shields.io/nuget/dt/EasyRefreshToken?color=blue&label=EasyRefreshToken&logo=nuget&style=flate"> </a> </td> </tr>
</tbody> <table>
- .Net 7: 7.1.2
- .Net 6: 6.1.2
- .Net 5: 5.1.2
Documentation
Make your
TUser
inherit fromIUser
.Create your own class
MyRefreshToken
and add to it the properties you want and make it inherit fromRefreshToken<TUser, TKey>
If you do not want to add new features, you can skip the previous step.
In AppDbContext Class:
public DbSet<RefreshToken<TUser, TKey>> RefreshTokens { get; set; }
orpublic DbSet<MyRefreshToken> RefreshTokens { get; set; }
In Program Class:
builder.Services.AddRefreshToken<AppDbContext, RefreshToken<TUser, TKey>, TUser, TKey>();
orbuilder.Services.AddRefreshToken<AppDbContext, MyRefreshToken, TUser, TKey>();
Don't forget:
Add-Migration
Update-Database
Now you can use
ITokenService<TKey>
that contains:OnLoginAsync
OnLogoutAsync
OnAccessTokenExpiredAsync
OnChangePasswordAsync
ClearAsync
ClearExpiredAsync
And you can control with many options:
MaxNumberOfActiveDevices
TokenExpiredDays
PreventingLoginWhenAccessToMaxNumberOfActiveDevices
TokenGenerationMethod
OnChangePasswordBehavior
SaveChanges
You can specifies a life time of the Service (the default is Scoped).
For
MaxNumberOfActiveDevices
useMaxNumberOfActiveDevices.Config()
.Note: when change on options, I highly recommend cleaning the table by
Clear
Enjoy ...
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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. |
-
net7.0
- Microsoft.EntityFrameworkCore (>= 7.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on EasyRefreshToken:
Package | Downloads |
---|---|
EasyRefreshToken.InMemory
Package for manage refresh token |
|
EasyRefreshToken.EFCore
Package for manage refresh token |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.2.2 | 236 | 1/5/2024 |
7.2.2 | 143 | 1/5/2024 |
7.2.1 | 224 | 6/27/2023 |
7.2.0 | 220 | 6/9/2023 |
7.1.2 | 192 | 5/21/2023 |
7.1.1 | 200 | 5/5/2023 |
7.1.0 | 272 | 2/24/2023 |
7.0.10 | 362 | 11/26/2022 |
6.2.2 | 171 | 1/5/2024 |
6.2.1 | 227 | 6/27/2023 |
6.2.0 | 154 | 6/9/2023 |
6.1.2 | 160 | 5/21/2023 |
6.1.1 | 182 | 5/5/2023 |
6.1.0 | 279 | 2/24/2023 |
6.0.10 | 366 | 11/4/2022 |
6.0.9 | 406 | 8/31/2022 |
6.0.8 | 463 | 7/8/2022 |
6.0.7 | 455 | 7/3/2022 |
6.0.6 | 442 | 6/20/2022 |
6.0.5 | 428 | 6/20/2022 |
5.2.2 | 173 | 1/5/2024 |
5.2.1 | 216 | 6/27/2023 |
5.2.0 | 158 | 6/9/2023 |
5.1.2 | 163 | 5/21/2023 |
5.1.1 | 166 | 5/5/2023 |
5.1.0 | 266 | 2/24/2023 |
5.0.10 | 383 | 11/5/2022 |
5.0.9 | 470 | 8/31/2022 |
5.0.8 | 522 | 7/8/2022 |
5.0.7 | 452 | 7/3/2022 |
5.0.6 | 424 | 6/20/2022 |
5.0.5 | 497 | 6/20/2022 |