Table of Contents

Class CapabilityTokenOptions

Namespace
ReferenceApplication.Web.Governance
Assembly
ReferenceApplication.Web.dll

Configures signed, short-lived, request-bound capability tokens for capability-protected endpoints.

public sealed class CapabilityTokenOptions
Inheritance
CapabilityTokenOptions
Inherited Members

Remarks

Disabled by default. While disabled, capability-protected endpoints use the claim-backed ClaimEndpointCapabilityGrantValidator. While enabled, the application registers AsiBackbone's signed capability grant validator instead, so those endpoints require a token issued by CapabilityTokenIssuer.

The signing key is a secret. Supply it through user secrets, an environment variable, or a secret store; it is never part of checked-in configuration. The verification keys are public, but they still decide which tokens are trusted, so they come from configuration rather than source. Startup fails when tokens are enabled without a usable signing key or without a trusted public key that matches it.

Every setting here is a host decision. Issuer, Audience, AllowedClockSkewSeconds, and KeyId are passed to AsiBackbone's validator options; VerificationKeys are passed to AsiBackbone's public-key verifier; LifetimeSeconds, KeyVersion, and SigningKeyPem apply at issuance through CapabilityTokenSigningKey; and UseStorePurgeIntervalSeconds schedules the purge of AsiBackbone's EF Core use store.

Fields

MaximumAllowedClockSkewSeconds

Gets the largest clock skew accepted from configuration.

public const int MaximumAllowedClockSkewSeconds = 60

Field Value

int

Remarks

The EF Core use store keeps each consumed grant until it expires plus this period, so a grant can never be purged while a validator could still accept it.

MaximumLifetimeSeconds

Gets the longest token lifetime accepted from configuration.

public const int MaximumLifetimeSeconds = 900

Field Value

int

MaximumUseStorePurgeIntervalSeconds

Gets the longest use store purge interval accepted from configuration.

public const int MaximumUseStorePurgeIntervalSeconds = 86400

Field Value

int

MinimumUseStorePurgeIntervalSeconds

Gets the shortest use store purge interval accepted from configuration.

public const int MinimumUseStorePurgeIntervalSeconds = 10

Field Value

int

SectionName

Gets the configuration section for capability tokens.

public const string SectionName = "ReferenceApplication:CapabilityTokens"

Field Value

string

Properties

AllowSampleSigningKeyInProduction

Gets or sets a value indicating whether capability tokens may be enabled in the Production environment with the sample issuance signing key.

public bool AllowSampleSigningKeyInProduction { get; set; }

Property Value

bool

Remarks

Verification and replay storage use AsiBackbone's production components, but issuance signs with AsiBackbone's configured-key local-development provider, which keeps the private key in process memory. Startup refuses it in Production unless this is set, so a deployment states the choice explicitly. A real production deployment signs through a managed key service, or issues tokens from a separate service, instead of setting this.

AllowedClockSkewSeconds

Gets or sets the clock skew tolerated when checking not-before and expiry times, in seconds.

public int AllowedClockSkewSeconds { get; set; }

Property Value

int

Audience

Gets or sets the audience written to, and required on, every token.

public string Audience { get; set; }

Property Value

string

Enabled

Gets or sets a value indicating whether capability-protected endpoints require signed capability tokens.

public bool Enabled { get; set; }

Property Value

bool

Issuer

Gets or sets the issuer written to, and required on, every token.

public string Issuer { get; set; }

Property Value

string

KeyId

Gets or sets the key identifier recorded in token proofs and required on them by the validator.

public string KeyId { get; set; }

Property Value

string

KeyVersion

Gets or sets the version of the current signing key. New tokens are signed with this version.

public string KeyVersion { get; set; }

Property Value

string

LifetimeSeconds

Gets or sets how long an issued token remains valid, in seconds.

public int LifetimeSeconds { get; set; }

Property Value

int

SigningKeyPem

Gets or sets the current PEM-encoded RSA private key, at least 2048 bits, used to sign tokens at issuance.

public string? SigningKeyPem { get; set; }

Property Value

string

Remarks

Verification never uses this key. Its public half must also be listed in VerificationKeys under KeyVersion, so the tokens this application issues verify.

UseStorePurgeIntervalSeconds

Gets or sets how often consumed grants past their retention horizon are purged from the use store, in seconds.

public int UseStorePurgeIntervalSeconds { get; set; }

Property Value

int

VerificationKeys

Gets or sets the trusted public key versions that verify token proofs.

public List<CapabilityTokenVerificationKeyOptions> VerificationKeys { get; set; }

Property Value

List<CapabilityTokenVerificationKeyOptions>

Remarks

List the current version, and during a rotation the previous one, until every token it signed has expired plus AllowedClockSkewSeconds.