Class AuthorizationBehavior<TMessage, TResponse>
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
TMessageThe message type, constrained to IAuthorize.
TResponseThe 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
actorProviderIActorProvider
Methods
Handle(TMessage, MessageHandlerDelegate<TMessage, TResponse>, CancellationToken)
public ValueTask<TResponse> Handle(TMessage message, MessageHandlerDelegate<TMessage, TResponse> next, CancellationToken cancellationToken)
Parameters
messageTMessagenextMessageHandlerDelegate<TMessage, TResponse>cancellationTokenCancellationToken
Returns
- ValueTask<TResponse>