Class MemoryNonceTracker
- Namespace
- Cuemon.AspNetCore.Authentication
- Assembly
- 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
Constructors
MemoryNonceTracker()
Initializes a new instance of the MemoryNonceTracker class.
public MemoryNonceTracker()
Methods
OnDisposeManagedResources()
Called when this object is being disposed by either Dispose() or Dispose(bool) having disposing set to true and Disposed is false.
protected override void OnDisposeManagedResources()
TryAddEntry(string, int)
Attempts to insert a NonceTrackerEntry into the tracker.
public bool TryAddEntry(string nonce, int count)
Parameters
noncestringThe unique identifier of the tracker.
countintThe number or bit string that should be used only once.
Returns
- bool
trueif insertion succeeded; otherwise,falsewhen there is already an entry in the tracker with the same key.
Exceptions
- ArgumentNullException
noncecannot be null.- ArgumentException
noncecannot be empty or consist only of white-space characters.
TryGetEntry(string, out NonceTrackerEntry)
Attempts to get the NonceTrackerEntry associated with the specified nonce from the tracker.
public bool TryGetEntry(string nonce, out NonceTrackerEntry entry)
Parameters
noncestringThe unique identifier of the tracker.
entryNonceTrackerEntryWhen this method returns, contains the entry associated with the specified
nonce, ornullif the operation failed.
Returns
- bool
trueif theentrywas found in the tracker; otherwise,false.
Exceptions
- ArgumentNullException
noncecannot be null.- ArgumentException
noncecannot be empty or consist only of white-space characters.
TryRemoveEntry(string)
Attempts to remove an entry from the tracker.
public bool TryRemoveEntry(string nonce)
Parameters
noncestringThe unique identifier of the tracker.
Returns
- bool
trueif the entry is removed from the tracker; otherwise,false.
Exceptions
- ArgumentNullException
noncecannot be null.- ArgumentException
noncecannot be empty or consist only of white-space characters.