Table of Contents

Class ActorProviderExtensions

Namespace
Trellis.Authorization
Assembly
Trellis.Authorization.dll

Provides required actor access for callers with established actor presence and stable provider resolution.

public static class ActorProviderExtensions
Inheritance
ActorProviderExtensions
Inherited Members

Methods

RequireActorAsync(IActorProvider, CancellationToken)

Resolves the current actor, throwing if the caller's actor-presence invariant is broken.

public static Task<Actor> RequireActorAsync(this IActorProvider actorProvider, CancellationToken cancellationToken = default)

Parameters

actorProvider IActorProvider

The provider used to resolve the actor.

cancellationToken CancellationToken

Token forwarded to the provider.

Returns

Task<Actor>

The same actor instance returned by the provider.

Remarks

Use only when actor presence is already guaranteed and the provider returns stable identity and authorization state throughout the operation. This method performs another provider lookup; it does not retrieve a snapshot captured by an authorization behavior. Authorization alone does not establish provider stability. When resolution can change, both authorization and the handler must use the same scoped caching provider, configured before either lookup. This method does not authenticate, check permissions, enforce stability, or cache the actor. It calls the provider once per invocation. For ordinary unauthenticated requests, use GetCurrentActorAsync(CancellationToken) and handle absence as Error.AuthenticationRequired instead. Provider exceptions and cancellation propagate unchanged.

Exceptions

ArgumentNullException

actorProvider is null.

InvalidOperationException

The provider returned no actor.