Table of Contents

Class SingletonApiKeyDataStoreRegistry

Namespace
Tlabs.Identity.Intern
Assembly
Tlabs.SrvBase.dll

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

options IOptions<SingletonApiKeyDataStoreRegistry.Options>

Methods

Deregister(string)

Deregisters the key with the specified tokenName

public KeyToken? Deregister(string tokenName)

Parameters

tokenName string

Returns

KeyToken

GenerateKey()

Generates a random, cryptographic API key

public string GenerateKey()

Returns

string

Register(KeyToken, string)

Registers the key for a given token

public KeyToken Register(KeyToken token, string key)

Parameters

token KeyToken
key string

Returns

KeyToken

The registered key token

RegisteredKeyCount()

Returns the total number of registered keys

public int RegisteredKeyCount()

Returns

int

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