Table of Contents

Class AuthorizationBehavior<TMessage, TResponse>

Namespace
Trellis.Mediator
Assembly
Trellis.Mediator.dll

Pipeline behavior that checks the current actor has all permissions declared in RequiredPermissions. Short-circuits with Error.Forbidden if any permission is missing.

public sealed class AuthorizationBehavior<TMessage, TResponse> : IPipelineBehavior<TMessage, TResponse> where TMessage : IAuthorize, IMessage where TResponse : IResult, IFailureFactory<TResponse>

Type Parameters

TMessage

The message type, constrained to IAuthorize.

TResponse

The response type, constrained to IResult and IFailureFactory<TSelf>.

Inheritance
AuthorizationBehavior<TMessage, TResponse>
Implements
IPipelineBehavior<TMessage, TResponse>
Inherited Members
Extension Methods

Constructors

AuthorizationBehavior(IActorProvider)

Pipeline behavior that checks the current actor has all permissions declared in RequiredPermissions. Short-circuits with Error.Forbidden if any permission is missing.

public AuthorizationBehavior(IActorProvider actorProvider)

Parameters

actorProvider IActorProvider

Methods

Handle(TMessage, MessageHandlerDelegate<TMessage, TResponse>, CancellationToken)

public ValueTask<TResponse> Handle(TMessage message, MessageHandlerDelegate<TMessage, TResponse> next, CancellationToken cancellationToken)

Parameters

message TMessage
next MessageHandlerDelegate<TMessage, TResponse>
cancellationToken CancellationToken

Returns

ValueTask<TResponse>