Class CapabilityTokenIssuer
- Namespace
- ReferenceApplication.Web.Governance
- Assembly
- ReferenceApplication.Web.dll
Issues signed, short-lived, single-use capability tokens bound to one actor, operation, and request payload.
public sealed class CapabilityTokenIssuer
- Inheritance
-
CapabilityTokenIssuer
- Inherited Members
Remarks
Every token is an AsiBackbone AsiBackbone.Core.CapabilityGrants.CapabilityGrant that carries the capability scopes, the subject (the governance actor identifier), the governed operation name, issue, not-before and expiry times, the governance policy version and hash, a form-field request binding, and a use limit of one. Signing and encoding use AsiBackbone's SignCapabilityGrantAsync(CapabilityGrant, IGovernanceSigningService, CanonicalPayloadOptions, string, string, string, IReadOnlyDictionary<string, string>, bool, string, CancellationToken) and AsiBackbone.Core.CapabilityGrants.CapabilityGrantToken, so the use limit is covered by the signature and the relying endpoint decodes the token with the same library code.
Issuance does not decide entitlement. The caller checks that the actor may hold the requested scopes before calling IssueAsync(CapabilityTokenIssueRequest, CancellationToken).
Issuance is host-owned: AsiBackbone does not issue grants. The library supplies the signing helper, the token encoding, and CreateBinding(IEnumerable<KeyValuePair<string, StringValues>>, IEnumerable<string>); the host decides who is entitled, the lifetime, the use limit, which key signs, and where the issuer runs. The signature must verify under a public key the relying endpoint's AsiBackbone.Core.Signing.IGovernanceSignatureVerificationService trusts; in this sample that is a VerificationKeys entry, and in production it is the public key of the managed key service that signs.
Constructors
CapabilityTokenIssuer(IOptions<CapabilityTokenOptions>, CapabilityTokenSigningKey, TimeProvider)
Issues signed, short-lived, single-use capability tokens bound to one actor, operation, and request payload.
public CapabilityTokenIssuer(IOptions<CapabilityTokenOptions> optionsAccessor, CapabilityTokenSigningKey signingKey, TimeProvider timeProvider)
Parameters
optionsAccessorIOptions<CapabilityTokenOptions>signingKeyCapabilityTokenSigningKeytimeProviderTimeProvider
Remarks
Every token is an AsiBackbone AsiBackbone.Core.CapabilityGrants.CapabilityGrant that carries the capability scopes, the subject (the governance actor identifier), the governed operation name, issue, not-before and expiry times, the governance policy version and hash, a form-field request binding, and a use limit of one. Signing and encoding use AsiBackbone's SignCapabilityGrantAsync(CapabilityGrant, IGovernanceSigningService, CanonicalPayloadOptions, string, string, string, IReadOnlyDictionary<string, string>, bool, string, CancellationToken) and AsiBackbone.Core.CapabilityGrants.CapabilityGrantToken, so the use limit is covered by the signature and the relying endpoint decodes the token with the same library code.
Issuance does not decide entitlement. The caller checks that the actor may hold the requested scopes before calling IssueAsync(CapabilityTokenIssueRequest, CancellationToken).
Issuance is host-owned: AsiBackbone does not issue grants. The library supplies the signing helper, the token encoding, and CreateBinding(IEnumerable<KeyValuePair<string, StringValues>>, IEnumerable<string>); the host decides who is entitled, the lifetime, the use limit, which key signs, and where the issuer runs. The signature must verify under a public key the relying endpoint's AsiBackbone.Core.Signing.IGovernanceSignatureVerificationService trusts; in this sample that is a VerificationKeys entry, and in production it is the public key of the managed key service that signs.
Methods
CreateGrant(CapabilityTokenIssueRequest)
Builds the unsigned grant that IssueAsync(CapabilityTokenIssueRequest, CancellationToken) would sign for a request.
public CapabilityGrant CreateGrant(CapabilityTokenIssueRequest request)
Parameters
requestCapabilityTokenIssueRequestWhat the token is bound to.
Returns
- CapabilityGrant
The grant, with a new token identifier and the current issuance time.
Remarks
The Development policy simulator previews a token through this method, so the preview shows exactly the claims, binding, and validity window issuance would sign, without signing anything or consuming a use.
IssueAsync(CapabilityTokenIssueRequest, CancellationToken)
Issues a signed capability token.
public ValueTask<IssuedCapabilityToken> IssueAsync(CapabilityTokenIssueRequest request, CancellationToken cancellationToken = default)
Parameters
requestCapabilityTokenIssueRequestWhat the token is bound to.
cancellationTokenCancellationTokenA token that cancels signing.
Returns
- ValueTask<IssuedCapabilityToken>
The encoded token and the values it is bound to.