Skip to main content
Table of Contents

Class AuthorizingCommandOutboxDispatcherServiceCollectionExtensions

Namespace
Microsoft.Extensions.DependencyInjection
Assembly
Stratara.Infrastructure.dll

Service-collection extensions that wrap the default ICommandOutboxDispatcher with Stratara.Infrastructure.Authorization.AuthorizingCommandOutboxDispatcher, enforcing RequireRoleAttribute and RequirePermissionAttribute checks on every enqueued command (permission enforcement activates when an IPermissionResolver is registered).

public static class AuthorizingCommandOutboxDispatcherServiceCollectionExtensions
Inheritance
AuthorizingCommandOutboxDispatcherServiceCollectionExtensions
Inherited Members

Methods

AddAuthorizingCommandOutboxDispatcher(IServiceCollection)

Registers Stratara.Infrastructure.Authorization.AuthorizingCommandOutboxDispatcher as the ICommandOutboxDispatcher (scoped), keeping the inner Stratara.Outbox.RabbitMQ.Outbox.CommandOutboxDispatcher available for direct resolution.

public static IServiceCollection AddAuthorizingCommandOutboxDispatcher(this IServiceCollection services)

Parameters

services IServiceCollection

The service collection.

Returns

IServiceCollection

The same service collection for chaining.

Examples

Register it after the dispatcher it decorates, so the outbox path enforces the same guards the mediator does:

services.AddOutboxDispatcher();
services.AddAuthorizingCommandOutboxDispatcher();