Table of Contents

Interface IGrantQueryStore

Namespace
Excalibur.A3.Authorization
Assembly
Excalibur.A3.Abstractions.dll

Extended query operations for authorization grants.

public interface IGrantQueryStore

Remarks

Follows the Microsoft ASP.NET Core Identity IQueryableUserStore<TUser> pattern: an ISP sub-interface accessed via GetService(Type).

Replaces IGrantQueryProvider from ISP split.

Methods

FindUserGrantsAsync(string, CancellationToken)

Finds grants keyed by a provider-specific shape.

Task<IReadOnlyDictionary<string, object>> FindUserGrantsAsync(string userId, CancellationToken cancellationToken)

Parameters

userId string

The user/subject identifier.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<IReadOnlyDictionary<string, object>>

Provider-specific projection of grants.

GetMatchingGrantsAcrossTenantsAsync(string?, string?, string?, CancellationToken)

Retrieves the grants of EVERY tenant that match every supplied filter.

Task<IReadOnlyList<Grant>> GetMatchingGrantsAcrossTenantsAsync(string? userId, string? grantType, string? qualifier, CancellationToken cancellationToken)

Parameters

userId string

The user to match, or null for every user.

grantType string

The grant type to match, or null for every type.

qualifier string

The qualifier to match, or null for every qualifier.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<IReadOnlyList<Grant>>

The matching grants, across every tenant.

Remarks

Deliberately estate-wide, for operator reads such as cross-tenant entitlement reports and orphan detection. It is a read: nothing that revokes or changes a grant should be driven from its result, because one call spans every tenant. Tenant-scoped work belongs on GetMatchingGrantsAsync(string, string?, string?, string?, CancellationToken).

Filters follow the same rules as GetMatchingGrantsAsync(string, string?, string?, string?, CancellationToken): ordinal equality, null means unfiltered, and an empty or whitespace filter is refused.

Its cost is the cost of reading across partitions: a partitioned store cannot serve it from one partition, so on DynamoDB it is a paginated scan and on Cosmos DB a cross-partition query.

Exceptions

ArgumentException

A non-null filter is empty or whitespace.

GetMatchingGrantsAsync(string, string?, string?, string?, CancellationToken)

Retrieves the grants of ONE tenant that match every supplied filter.

Task<IReadOnlyList<Grant>> GetMatchingGrantsAsync(string tenantId, string? userId, string? grantType, string? qualifier, CancellationToken cancellationToken)

Parameters

tenantId string

The tenant whose grants are read. Required.

userId string

The user to match, or null for every user.

grantType string

The grant type to match, or null for every type.

qualifier string

The qualifier to match, or null for every qualifier.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<IReadOnlyList<Grant>>

The matching grants.

Remarks

Returns exactly the non-revoked grants whose tenant equals tenantId and, for every filter that is not null, whose field equals that filter under ORDINAL comparison -- case-sensitive, with no wildcards and no collation folding. Expired grants are included; the order is unspecified.

null, and only null, means "do not filter on this field". An empty or whitespace filter is refused rather than read as "all", because a value that means "match everything" is exactly what a caller passes by accident.

A single-tenant host stores its grants under the untenanted sentinel and passes that value here. To read across tenants, call GetMatchingGrantsAcrossTenantsAsync(string?, string?, string?, CancellationToken), which says so in its name.

Exceptions

ArgumentException

tenantId is null, empty or whitespace, or a non-null filter is empty or whitespace.