Skip to content

AuditActorContext

Namespace AgentPrism · Assembly AgentPrism.Core.dll

An ambient context that carries the user of the current call.

public static class AuditActorContext

objectAuditActorContext

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

AgentPrism.AspNetCore writes HttpContext.User to AuditActorContext.Current at the start of every protected request, after security checks pass. The value is held in Threading.AsyncLocal, so code later in the same request’s async call chain, such as a store decorator, can read it. This is the same mechanism as Activity.Current.

This design lets AgentPrism.Core read the actor without adding a dependency on IHttpContextAccessor or ASP.NET Core. ClaimsPrincipal is in the base.NET library, not specific to ASP.NET Core.

The user of the current call, or null when it is not set.

public static ClaimsPrincipal? Current { get; set; }

ClaimsPrincipal?