Skip to content
Tracon

IAuditActorResolver

Namespace Tracon · Assembly Tracon.Abstractions.dll

Resolves the actor (the who) of the current call.

public interface IAuditActorResolver

The default implementation reads the user of the HTTP request. It returns null when there is no authentication or the actor cannot be resolved; that state is not hidden, and the user interface shows “unknown”.

DI lifetime — singleton. Registered as a singleton with TryAdd; a consumer’s own registration wins. The default implementation is safe as a singleton because it does not capture any per-request state itself — it reads IAuditActorResolver.Resolve’s caller on each call from AuditActorContext.Current, an Threading.AsyncLocal ambient scope that Tracon.AspNetCore populates per request (the same mechanism as Activity.Current). A replacement implementation that instead captured a scoped dependency in its constructor would be a captive dependency.

Tenant behavior — TENANT-INDEPENDENT. This interface answers “which user”, never “which tenant”; it carries no tenant parameter and applies no tenant filtering of its own.

Resolves the current actor.

string? Resolve()

string?

The actor id, or null when it cannot be resolved.