Table of Contents

Class TenantScopedCredentialStore

Namespace
JD.AI.Core.Providers.Credentials
Assembly
JD.AI.Core.dll

Wraps an underlying ICredentialStore and enforces tenant-namespace isolation. All credential keys are automatically prefixed with the current tenant ID so that credentials belonging to different tenants cannot be accessed across tenant boundaries.

public sealed class TenantScopedCredentialStore : ICredentialStore
Inheritance
TenantScopedCredentialStore
Implements
Inherited Members

Remarks

This store should be registered as a scoped service so that it inherits the current TenantContext from the DI scope.

Constructors

TenantScopedCredentialStore(ICredentialStore, TenantContext)

Initializes a new TenantScopedCredentialStore.

public TenantScopedCredentialStore(ICredentialStore inner, TenantContext tenantContext)

Parameters

inner ICredentialStore

The backing credential store (e.g. EncryptedFileStore, Azure KV).

tenantContext TenantContext

The current tenant scope.

Properties

IsAvailable

Whether this store is available on the current platform.

public bool IsAvailable { get; }

Property Value

bool

StoreName

Human-readable name of the backing store.

public string StoreName { get; }

Property Value

string

Methods

GetAsync(string, CancellationToken)

Gets a stored credential value.

public Task<string?> GetAsync(string key, CancellationToken ct = default)

Parameters

key string
ct CancellationToken

Returns

Task<string>

ListKeysAsync(string, CancellationToken)

Lists all keys matching a prefix.

public Task<IReadOnlyList<string>> ListKeysAsync(string prefix, CancellationToken ct = default)

Parameters

prefix string
ct CancellationToken

Returns

Task<IReadOnlyList<string>>

RemoveAsync(string, CancellationToken)

Removes a stored credential.

public Task RemoveAsync(string key, CancellationToken ct = default)

Parameters

key string
ct CancellationToken

Returns

Task

SetAsync(string, string, CancellationToken)

Stores a credential value.

public Task SetAsync(string key, string value, CancellationToken ct = default)

Parameters

key string
value string
ct CancellationToken

Returns

Task