Class ClaimsBasedNamespaceResolver

Namespace
Cratis.Chronicle
Assembly
Cratis.Chronicle.dll

Represents an implementation of IEventStoreNamespaceResolver that resolves the namespace from the current user's claims.

public class ClaimsBasedNamespaceResolver : IEventStoreNamespaceResolver
Inheritance
ClaimsBasedNamespaceResolver
Implements
Inherited Members
Extension Methods

Remarks

By default this resolver reads the current principal from Current to resolve the namespace. It is useful in scenarios where you need to resolve namespaces based on user identity without requiring HTTP context. Supply a principal accessor to read the principal from somewhere else.

Constructors

ClaimsBasedNamespaceResolver(Func<ClaimsPrincipal?>, string)

Represents an implementation of IEventStoreNamespaceResolver that resolves the namespace from the current user's claims.

public ClaimsBasedNamespaceResolver(Func<ClaimsPrincipal?> currentPrincipal, string claimType = "tenant_id")

Parameters

currentPrincipal Func<ClaimsPrincipal>

Callback that returns the current ClaimsPrincipal, or null when there is none.

claimType string

The claim type to use for resolving the namespace. Defaults to "tenant_id".

Remarks

By default this resolver reads the current principal from Current to resolve the namespace. It is useful in scenarios where you need to resolve namespaces based on user identity without requiring HTTP context. Supply a principal accessor to read the principal from somewhere else.

ClaimsBasedNamespaceResolver(string)

Initializes a new instance of the ClaimsBasedNamespaceResolver class that reads the principal from Current.

public ClaimsBasedNamespaceResolver(string claimType = "tenant_id")

Parameters

claimType string

The claim type to use for resolving the namespace. Defaults to "tenant_id".

Methods

Resolve()

Resolves the current event store namespace.

public EventStoreNamespaceName Resolve()

Returns

EventStoreNamespaceName

The EventStoreNamespaceName to use.