Table of Contents

Class SecretKeyCache

Namespace
FoundationaLLM.AuthorizationEngine.Services
Assembly
FoundationaLLM.AuthorizationEngine.dll

In-memory cache for secret keys.

public class SecretKeyCache
Inheritance
SecretKeyCache
Inherited Members
Extension Methods

Remarks

Initializes a new instance of the SecretKeyCache class.

Constructors

SecretKeyCache(SecretKeyStore, IConfiguration, ILogger)

In-memory cache for secret keys.

public SecretKeyCache(SecretKeyStore secretKeyStore, IConfiguration configuration, ILogger logger)

Parameters

secretKeyStore SecretKeyStore

The SecretKeyStore containing the data to initialize the cache.

configuration IConfiguration

The application configuration values.

logger ILogger

The ILogger used for logging.

Remarks

Initializes a new instance of the SecretKeyCache class.

Methods

AddOrUpdatePersistedSecretKey(PersistedSecretKey)

Adds or updates a secret key in the cache.

public void AddOrUpdatePersistedSecretKey(PersistedSecretKey persistedSecretKey)

Parameters

persistedSecretKey PersistedSecretKey

The PersistedSecretKey to add or update in the cache.

GetKeys(string)

Gets the secret key associated with the specified context and key identifier.

public List<PersistedSecretKey> GetKeys(string contextId)

Parameters

contextId string

The context to which the secret keys belong.

Returns

List<PersistedSecretKey>

RemovePersistedSecretKey(PersistedSecretKey)

Adds or updates a secret key in the cache.

public void RemovePersistedSecretKey(PersistedSecretKey persistedSecretKey)

Parameters

persistedSecretKey PersistedSecretKey

The PersistedSecretKey to add or update in the cache.

TryGetKey(string, string, out PersistedSecretKey)

Gets the secret key associated with the specified context and key identifier.

public bool TryGetKey(string contextId, string keyId, out PersistedSecretKey key)

Parameters

contextId string

The context to which the secret key belongs.

keyId string

The identifier of the secret key.

key PersistedSecretKey

The PersistedSecretKey that is looked for.

Returns

bool

true if the secret key was found, false otherwise.