Table of Contents

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

UserId string

The user/subject identifier.

FullName string

Optional display name.

TenantId string

The tenant identifier. Required; a grant always belongs to exactly one tenant.

GrantType string

The type of grant (e.g., role, activity-group).

Qualifier string

The qualifier or scope for the grant.

ExpiresOn DateTimeOffset?

Optional expiration timestamp (UTC).

GrantedBy string

Identifier that issued the grant.

GrantedOn DateTimeOffset

Timestamp when the grant was issued (UTC).

Properties

ExpiresOn

Optional expiration timestamp (UTC).

public DateTimeOffset? ExpiresOn { get; init; }

Property Value

DateTimeOffset?

FullName

Optional display name.

public string? FullName { get; init; }

Property Value

string

GrantType

The type of grant (e.g., role, activity-group).

public string GrantType { get; init; }

Property Value

string

GrantedBy

Identifier that issued the grant.

public string GrantedBy { get; init; }

Property Value

string

GrantedOn

Timestamp when the grant was issued (UTC).

public DateTimeOffset GrantedOn { get; init; }

Property Value

DateTimeOffset

Qualifier

The qualifier or scope for the grant.

public string Qualifier { get; init; }

Property Value

string

TenantId

The tenant identifier. Required; a grant always belongs to exactly one tenant.

public string TenantId { get; init; }

Property Value

string

UserId

The user/subject identifier.

public string UserId { get; init; }

Property Value

string

Methods

IsActive(DateTimeOffset)

Determines whether this grant is active (not expired) as of the supplied instant.

public bool IsActive(DateTimeOffset asOf)

Parameters

asOf DateTimeOffset

The instant to evaluate against (typically the current UTC time).

Returns

bool

true if the grant is not expired as of asOf.

IsExpired(DateTimeOffset)

Determines whether this grant has expired as of the supplied instant.

public bool IsExpired(DateTimeOffset asOf)

Parameters

asOf DateTimeOffset

The 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.