Skip to content

TenantProviderCredentialResolver

Namespace AgentPrism · Assembly AgentPrism.Core.dll

Resolves a tenant’s TenantProviderBinding into a ModelProviderCredential by reading the bound configuration key’s value.

public sealed class TenantProviderCredentialResolver

objectTenantProviderCredentialResolver

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

AgentPrismTenantProviderOptions.AllowedConfigurationPrefix is checked here too, not only where a binding is written. A binding written before the prefix was configured (or through a store the endpoint layer did not validate) must not silently read an out-of-prefix configuration key (defense in two layers).

TenantProviderCredentialResolver(IConfiguration?, IOptionsMonitor<AgentPrismTenantProviderOptions>)

Section titled “ TenantProviderCredentialResolver(IConfiguration?, IOptionsMonitor<AgentPrismTenantProviderOptions>)”

Creates a new resolver.

public TenantProviderCredentialResolver(IConfiguration? configuration, IOptionsMonitor<AgentPrismTenantProviderOptions> options)

configuration IConfiguration?

The application’s configuration root. When null (a hosting setup with no IConfiguration registered), TenantProviderCredentialResolver.Resolve always returns null.

options IOptionsMonitor<AgentPrismTenantProviderOptions>

The tenant provider options.

ArgumentNullException

options is null.

Resolves a binding into a credential by reading its configuration key.

public ModelProviderCredential? Resolve(TenantProviderBinding binding)

binding TenantProviderBinding

The binding to resolve.

ModelProviderCredential?

The resolved credential; null if the configuration key has no value (the binding exists, but the secret was never set — this must not fall back to the global key silently).

AgentPrismException

TenantProviderBinding.ApiKeyConfigurationName is outside the allowed prefix.

Validates that a configuration key name is under the allowed prefix.

public void ValidatePrefix(string configurationKeyName)

configurationKeyName string

The configuration key name to check.

AgentPrismException

The name is empty, or does not start with AgentPrismTenantProviderOptions.AllowedConfigurationPrefix.