Table of Contents

Class GrantKey

Namespace
Excalibur.A3.Authorization.Grants
Assembly
Excalibur.A3.Core.dll

Utility class for representing and managing unique keys associated with grants in a system. A grant key is composed of a userId and a GrantScope, where the GrantScope encapsulates the tenantId, grantType, and qualifier. This class ensures consistent construction, parsing, and serialization of grant keys.

public sealed class GrantKey
Inheritance
GrantKey
Inherited Members

Constructors

GrantKey(string)

Initializes a new instance of the GrantKey class from a serialized key string.

public GrantKey(string key)

Parameters

key string

The serialized grant key in the format {userId}:{tenant}:{type}:{qualifier}.

Exceptions

ArgumentException

Thrown if the key is null, empty, or improperly formatted.

GrantKey(string?, string?, string?, string?)

Initializes a new instance of the GrantKey class.

public GrantKey(string? userId, string? tenantId, string? grantType, string? qualifier)

Parameters

userId string

The user ID associated with the grant.

tenantId string

The tenant ID for the grant.

grantType string

The type of the grant.

qualifier string

The qualifier for the grant.

Exceptions

ArgumentException

Thrown if any argument is null or empty.

Properties

Scope

Gets the scope of the grant, which includes tenant, type, and qualifier.

public GrantScope Scope { get; init; }

Property Value

GrantScope

The scope of the grant.

UserId

Gets the user ID associated with the grant.

public string UserId { get; init; }

Property Value

string

The user ID.

Methods

ToString()

Converts the GrantKey instance to its string representation.

public override string ToString()

Returns

string

A string representation of the grant key in the format {userId}:{tenant}:{type}:{qualifier}.