MemoryNonceTracker Class
Definition
- Namespace
- Cuemon.AspNetCore.Authentication
- Assemblies
- Cuemon.AspNetCore.Authentication.dll
Provides a default in-memory implementation of the INonceTracker interface.
public class MemoryNonceTracker : Disposable, IDisposable, INonceTracker
- Inheritance
-
MemoryNonceTracker
- Implements
- Inherited Members
Examples
The following example demonstrates how to add, inspect, and remove nonce entries from the in-memory tracker.
using System;
using Cuemon.AspNetCore.Authentication;
namespace MyApp.Examples;
public static class MemoryNonceTrackerExample
{
public static void Demonstrate()
{
using var tracker = new MemoryNonceTracker();
tracker.TryAddEntry("nonce-1", 7);
if (tracker.TryGetEntry("nonce-1", out var entry))
{
Console.WriteLine(entry.Count);
}
Console.WriteLine(tracker.TryRemoveEntry("nonce-1"));
}
}
Constructors
| Name | Description |
|---|---|
| MemoryNonceTracker() | Initializes a new instance of the MemoryNonceTracker class. |
Methods
| Name | Description |
|---|---|
| OnDisposeManagedResources() | Called when this object is being disposed by either Dispose() or Dispose(bool) having |
| TryAddEntry(string, int) | Attempts to insert a NonceTrackerEntry into the tracker. |
| TryGetEntry(string, out NonceTrackerEntry) | Attempts to get the NonceTrackerEntry associated with the specified |
| TryRemoveEntry(string) | Attempts to remove an entry from the tracker. |