Class SingletonApiKeyDataStoreRegistry
ApiKey registry that maintains KeyToken(s) in a persistent IDataStore.
public class SingletonApiKeyDataStoreRegistry : IApiKeyRegistry
- Inheritance
-
SingletonApiKeyDataStoreRegistry
- Implements
- Inherited Members
- Extension Methods
Remarks
ATTENTION: This must be registers as a singleton with any DI service collection!
KeyToken(s) are cached in memory.
Constructors
SingletonApiKeyDataStoreRegistry(IOptions<Options>)
Ctor from options
public SingletonApiKeyDataStoreRegistry(IOptions<SingletonApiKeyDataStoreRegistry.Options> options)
Parameters
Methods
Deregister(string)
Deregisters the key with the specified tokenName
public KeyToken? Deregister(string tokenName)
Parameters
tokenName
string
Returns
GenerateKey()
Generates a random, cryptographic API key
public string GenerateKey()
Returns
Register(KeyToken, string)
Registers the key
for a given token
public KeyToken Register(KeyToken token, string key)
Parameters
Returns
- KeyToken
The registered key token
RegisteredKeyCount()
Returns the total number of registered keys
public int RegisteredKeyCount()
Returns
RegisteredKeys()
Returns an array of all currently registered key tokens, including keys that are expired but not deleted
public KeyToken[] RegisteredKeys()
Returns
- KeyToken[]
VerifiedKey(string)
Key verification routine
public KeyToken? VerifiedKey(string key)
Parameters
key
string
Returns
- KeyToken
The
associated with the key
if the key is valid, null otherwise