diff options
author | vnugent <public@vaughnnugent.com> | 2024-04-27 18:42:57 -0400 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2024-04-27 18:42:57 -0400 |
commit | dfbb88e7ad4e25215e70b2a457bcccad2834a1bf (patch) | |
tree | 42688dfedc84be64091df59dc86115bcd116bf97 /plugins/VNLib.Plugins.Essentials.Accounts.Registration/src/TokenRevocation | |
parent | a74cd045c0a67e0caef98bc79d2064f53b3cd792 (diff) |
Squashed commit of the following:
commit 3df7bdbaa9371f552c71162022c6ccc618be8bac
Author: vnugent <public@vaughnnugent.com>
Date: Sat Apr 27 18:42:26 2024 -0400
chore: fix missing !, cleanup project files
commit 6ec4156fb5c996d00a027f767fee7e6314e91582
Merge: 377c8a5 a74cd04
Author: vnugent <public@vaughnnugent.com>
Date: Sat Apr 27 17:40:30 2024 -0400
Merge branch 'master' into develop
commit 377c8a5f8bb272eff5089094f5b764eb043b728f
Author: vnugent <public@vaughnnugent.com>
Date: Sat Apr 27 17:28:25 2024 -0400
fix: Missing cookie set on cred regen
commit a12873dceecc72c9af3966002bfca9faefc5aac7
Merge: 2963bf6 8d57b05
Author: vnugent <public@vaughnnugent.com>
Date: Sat Apr 20 12:07:42 2024 -0400
Merge branch 'master' into develop
commit 2963bf62919b3bfac4aa5055d57fe91f93ca8a0b
Author: vnugent <public@vaughnnugent.com>
Date: Sat Apr 20 11:59:45 2024 -0400
chore: Package updates
commit 9539717a751baae762498a2cadfe94ef8fda5830
Merge: 44803e0 a7cf7c8
Author: vnugent <public@vaughnnugent.com>
Date: Mon Apr 8 22:04:26 2024 -0400
Merge branch 'master' into develop
commit 44803e06d1aa45496c04127930aa8897272d42f6
Author: vnugent <public@vaughnnugent.com>
Date: Mon Apr 8 21:41:38 2024 -0400
fix: dangling/expired session security check and cookie cleanup
commit 1082bd146549a1aff47877bcd28e6be1ce0ef5e9
Author: vnugent <public@vaughnnugent.com>
Date: Sat Mar 30 22:20:29 2024 -0400
feat(app): Add AppData client plugin and browser library updated
commit ec9b42f4cacbeae8a0b4d96e48bd9e522b3a9145
Merge: 2a11454 27b487b
Author: vnugent <public@vaughnnugent.com>
Date: Sun Mar 24 21:16:05 2024 -0400
Merge branch 'master' into develop
commit 2a114541a3bfddae887adaa98c1ed326b125d511
Author: vnugent <public@vaughnnugent.com>
Date: Sun Mar 24 20:53:38 2024 -0400
refactor: pull apart session authorization for future dev
commit f8aea6453ddb2d56c1ce2ecb6a9e67d1af523c2e
Author: vnugent <public@vaughnnugent.com>
Date: Thu Mar 21 14:33:21 2024 -0400
feat: Add optional svg base64 icons for social OAuth2 connections
commit cc29bed99dc9e151315cce75e50d55dca306b532
Author: vnugent <public@vaughnnugent.com>
Date: Sun Mar 10 21:58:27 2024 -0400
source tree project location updated
Diffstat (limited to 'plugins/VNLib.Plugins.Essentials.Accounts.Registration/src/TokenRevocation')
-rw-r--r-- | plugins/VNLib.Plugins.Essentials.Accounts.Registration/src/TokenRevocation/RevokedTokenStore.cs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/plugins/VNLib.Plugins.Essentials.Accounts.Registration/src/TokenRevocation/RevokedTokenStore.cs b/plugins/VNLib.Plugins.Essentials.Accounts.Registration/src/TokenRevocation/RevokedTokenStore.cs index 1a3e676..e63b02e 100644 --- a/plugins/VNLib.Plugins.Essentials.Accounts.Registration/src/TokenRevocation/RevokedTokenStore.cs +++ b/plugins/VNLib.Plugins.Essentials.Accounts.Registration/src/TokenRevocation/RevokedTokenStore.cs @@ -22,6 +22,11 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + using Microsoft.EntityFrameworkCore; using VNLib.Utils; @@ -29,18 +34,11 @@ using VNLib.Plugins.Extensions.Loading; namespace VNLib.Plugins.Essentials.Accounts.Registration.TokenRevocation { - internal class RevokedTokenStore + internal class RevokedTokenStore(IAsyncLazy<DbContextOptions> options) { - private readonly IAsyncLazy<DbContextOptions> Options; - - public RevokedTokenStore(IAsyncLazy<DbContextOptions> options) - { - Options = options; - } - public async Task<bool> IsRevokedAsync(string token, CancellationToken cancellation) { - await using RegistrationContext context = new (Options.Value); + await using RegistrationContext context = new (options.Value); //Select any that match tokens bool any = await (from t in context.RevokedRegistrationTokens @@ -54,7 +52,7 @@ namespace VNLib.Plugins.Essentials.Accounts.Registration.TokenRevocation public async Task RevokeAsync(string token, CancellationToken cancellation) { - await using RegistrationContext context = new (Options.Value); + await using RegistrationContext context = new (options.Value); //Add to table context.RevokedRegistrationTokens.Add(new RevokedToken @@ -77,7 +75,7 @@ namespace VNLib.Plugins.Essentials.Accounts.Registration.TokenRevocation { DateTime expiredBefore = DateTime.UtcNow.Subtract(validFor); - await using RegistrationContext context = new (Options.Value); + await using RegistrationContext context = new (options.Value); //Select any that match tokens RevokedToken[] expired = await context.RevokedRegistrationTokens.Where(t => t.Created < expiredBefore) |