Interface IGrantStore
- Namespace
- Excalibur.A3.Authorization
- Assembly
- Excalibur.A3.Abstractions.dll
Provider-neutral store for authorization grant persistence.
public interface IGrantStore : IServiceProvider
- Inherited Members
Remarks
Follows the Microsoft ASP.NET Core Identity IUserStore<TUser> pattern:
minimal CRUD surface (5 methods) with GetService(Type) for ISP extensions.
Replaces both the internal IGrantRequestProvider (11-method, SQL-coupled) and the
abstractions-level IGrantRequestProvider (5 methods + GetService).
Optional capabilities — including durability, discovered via IDurableGrantStore —
are resolved through GetService(Type), never by casting the store.
A store answers for the capabilities it provides; decorators MUST forward GetService to the
wrapped store.
Methods
DeleteGrantAsync(string, string, string, string, string?, DateTimeOffset?, CancellationToken)
Deletes a grant with optional revocation metadata.
Task<int> DeleteGrantAsync(string userId, string tenantId, string grantType, string qualifier, string? revokedBy, DateTimeOffset? revokedOn, CancellationToken cancellationToken)
Parameters
userIdstringThe user/subject identifier.
tenantIdstringThe tenant identifier.
grantTypestringThe grant type.
qualifierstringThe qualifier/scope.
revokedBystringOptional actor identifier who revoked the grant.
revokedOnDateTimeOffset?Optional revocation timestamp (UTC).
cancellationTokenCancellationTokenCancellation token.
Returns
GetAllGrantsAsync(string, bool, CancellationToken)
Retrieves all grants for a user, optionally including expired grants.
Task<IReadOnlyList<Grant>> GetAllGrantsAsync(string userId, bool includeExpired, CancellationToken cancellationToken)
Parameters
userIdstringThe user/subject identifier.
includeExpiredbooltrue to include expired grants; false to return only active (non-expired) grants. Authorization and SoD decision paths MUST pass false.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<IReadOnlyList<Grant>>
All grants for the specified user, filtered per
includeExpired.
GetAllGrantsAsync(string, CancellationToken)
Retrieves all active (non-expired) grants for a user.
Task<IReadOnlyList<Grant>> GetAllGrantsAsync(string userId, CancellationToken cancellationToken)
Parameters
userIdstringThe user/subject identifier.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<IReadOnlyList<Grant>>
All non-expired grants for the specified user.
Remarks
This overload is default-secure: expired grants are excluded so they can never
influence an authorization or separation-of-duties decision (Microsoft soft-delete-filter
pattern). Callers that legitimately need expired grants (reporting, orphaned-access
detection, reconciliation) MUST use the
GetAllGrantsAsync(string, bool, CancellationToken) overload with
includeExpired: true.
GetGrantAsync(string, string, string, string, CancellationToken)
Retrieves a specific grant.
Task<Grant?> GetGrantAsync(string userId, string tenantId, string grantType, string qualifier, CancellationToken cancellationToken)
Parameters
userIdstringThe user/subject identifier.
tenantIdstringThe tenant identifier.
grantTypestringThe grant type.
qualifierstringThe qualifier/scope.
cancellationTokenCancellationTokenCancellation token.
Returns
GrantExistsAsync(string, string, string, string, CancellationToken)
Checks whether a specific grant exists.
Task<bool> GrantExistsAsync(string userId, string tenantId, string grantType, string qualifier, CancellationToken cancellationToken)
Parameters
userIdstringThe user/subject identifier.
tenantIdstringThe tenant identifier.
grantTypestringThe grant type.
qualifierstringThe qualifier/scope.
cancellationTokenCancellationTokenCancellation token.
Returns
SaveGrantAsync(Grant, CancellationToken)
Saves or updates a grant (upsert).
Task<int> SaveGrantAsync(Grant grant, CancellationToken cancellationToken)
Parameters
grantGrantThe grant to persist.
cancellationTokenCancellationTokenCancellation token.