Table of Contents

Class SourceCredentialResolver

Namespace
Virtufin.WorkManager.Components
Assembly
Virtufin.WorkManager.dll

Resolves the effective AuthenticationHeaderValue for a code source fetch (WorkManager.FetchFromUrlAsync) from a per-request Virtufin.WorkManager.Protos.SourceCredential, replacing the former RegistryAuthHandler -- a DelegatingHandler registered unconditionally on the CodeFetcher IHttpClientFactory client and applied to every request whose host matched, regardless of whether the caller actually wanted the org credential used. Credentials are now explicit and per-request: a directly-supplied Basic/Bearer secret, or a named reference resolved server-side (see ResolveNamed(string, string, out string?)) so that secret never has to be distributed to callers.

public static class SourceCredentialResolver
Inheritance
SourceCredentialResolver
Inherited Members

Fields

DefaultRegistryHosts

Host patterns the VirtufinRegistryCredentialName credential may be used against. Both names point at the same Gitea backend (one is a DNS alias of the other).

public static readonly string[] DefaultRegistryHosts

Field Value

string[]

VirtufinRegistryCredentialName

The only named reference this resolver recognizes. Reserved in virtufin-tui's credentials.toml: a personal entry named this can never shadow it.

public const string VirtufinRegistryCredentialName = "virtufin"

Field Value

string

Methods

Resolve(CodeSourceUrl, SourceCredential?)

Resolves the effective AuthenticationHeaderValue for fetching urlSource. liveCredential (a fresh request's own Virtufin.WorkManager.Protos.SourceCredential) takes precedence when present -- covers Basic/Bearer/named alike. Falls back to NamedCredential (the only credential kind that survives into persisted state) so a recovery re-fetch of a worker created with authentication = "virtufin" keeps working after a WorkManager restart, even with no live request credential. Returns null (no header) when neither is present.

public static AuthenticationHeaderValue? Resolve(CodeSourceUrl urlSource, SourceCredential? liveCredential)

Parameters

urlSource CodeSourceUrl
liveCredential SourceCredential

Returns

AuthenticationHeaderValue

Exceptions

InvalidOperationException

The credential is a named reference that can't be resolved (unrecognized name, or the host isn't permitted for it).

ResolveNamed(string, string, out string?)

Resolves a named credential reference against targetHost. Currently only VirtufinRegistryCredentialName is recognized, read from VIRTUFIN_REGISTRY_USER/VIRTUFIN_REGISTRY_TOKEN process environment variables on each call (not cached -- these rarely change and reading them fresh keeps a rotated token picked up without a restart).

public static AuthenticationHeaderValue? ResolveNamed(string name, string targetHost, out string? error)

Parameters

name string
targetHost string
error string

Returns

AuthenticationHeaderValue

An AuthenticationHeaderValue on success, or null with error set if the name is unrecognized, the host isn't permitted for it, or the org credential isn't configured on this instance.