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(Boolean) having disposing
set to true
and Disposed is false
.
protected override void OnDisposeManagedResources()
TryAddEntry(String, Int32)
Attempts to insert a NonceTrackerEntry into the tracker.
public bool TryAddEntry(string nonce, int count)
Parameters
nonce
StringThe unique identifier of the tracker.
count
Int32The number or bit string that should be used only once.
Returns
- Boolean
true
if insertion succeeded; otherwise,false
when there is already an entry in the tracker with the same key.
Exceptions
- ArgumentNullException
nonce
cannot be null.- ArgumentException
nonce
cannot 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
nonce
StringThe unique identifier of the tracker.
entry
NonceTrackerEntryWhen this method returns, contains the entry associated with the specified
nonce
, ornull
if the operation failed.
Returns
- Boolean
true
if theentry
was found in the tracker; otherwise,false
.
Exceptions
- ArgumentNullException
nonce
cannot be null.- ArgumentException
nonce
cannot 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
nonce
StringThe unique identifier of the tracker.
Returns
- Boolean
true
if the entry is removed from the tracker; otherwise,false
.
Exceptions
- ArgumentNullException
nonce
cannot be null.- ArgumentException
nonce
cannot be empty or consist only of white-space characters.