Class Grant
- Namespace
- Excalibur.A3.Authorization
- Assembly
- Excalibur.A3.Abstractions.dll
Provider-neutral authorization grant assigned to a subject for a specific qualifier.
public sealed record Grant : IEquatable<Grant>
- Inheritance
-
Grant
- Implements
- Inherited Members
Constructors
Grant(string, string?, string, string, string, DateTimeOffset?, string, DateTimeOffset)
Provider-neutral authorization grant assigned to a subject for a specific qualifier.
public Grant(string UserId, string? FullName, string TenantId, string GrantType, string Qualifier, DateTimeOffset? ExpiresOn, string GrantedBy, DateTimeOffset GrantedOn)
Parameters
UserIdstringThe user/subject identifier.
FullNamestringOptional display name.
TenantIdstringThe tenant identifier. Required; a grant always belongs to exactly one tenant.
GrantTypestringThe type of grant (e.g., role, activity-group).
QualifierstringThe qualifier or scope for the grant.
ExpiresOnDateTimeOffset?Optional expiration timestamp (UTC).
GrantedBystringIdentifier that issued the grant.
GrantedOnDateTimeOffsetTimestamp when the grant was issued (UTC).
Properties
ExpiresOn
Optional expiration timestamp (UTC).
public DateTimeOffset? ExpiresOn { get; init; }
Property Value
FullName
Optional display name.
public string? FullName { get; init; }
Property Value
GrantType
The type of grant (e.g., role, activity-group).
public string GrantType { get; init; }
Property Value
GrantedBy
Identifier that issued the grant.
public string GrantedBy { get; init; }
Property Value
GrantedOn
Timestamp when the grant was issued (UTC).
public DateTimeOffset GrantedOn { get; init; }
Property Value
Qualifier
The qualifier or scope for the grant.
public string Qualifier { get; init; }
Property Value
TenantId
The tenant identifier. Required; a grant always belongs to exactly one tenant.
public string TenantId { get; init; }
Property Value
UserId
The user/subject identifier.
public string UserId { get; init; }
Property Value
Methods
IsActive(DateTimeOffset)
Determines whether this grant is active (not expired) as of the supplied instant.
public bool IsActive(DateTimeOffset asOf)
Parameters
asOfDateTimeOffsetThe instant to evaluate against (typically the current UTC time).
Returns
IsExpired(DateTimeOffset)
Determines whether this grant has expired as of the supplied instant.
public bool IsExpired(DateTimeOffset asOf)
Parameters
asOfDateTimeOffsetThe instant to evaluate expiry against (typically the current UTC time).
Returns
- bool
true if the grant has an ExpiresOn value at or before
asOf; otherwise false. A null ExpiresOn never expires.
Remarks
The boundary is inclusive (ExpiresOn <= asOf is expired), matching the
SQL store precedent (ExpiresOn > GETUTCDATE() is active). The predicate is
pure and clock-free — callers pass the instant so behavior is deterministic and testable.