< Summary

Information
Class: AsiBackbone.AspNetCore.Endpoints.EndpointCapabilityGrantFeature
Assembly: AsiBackbone.AspNetCore
File(s): /home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.AspNetCore/Endpoints/IEndpointCapabilityGrantFeature.cs
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 40
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%

File(s)

/home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.AspNetCore/Endpoints/IEndpointCapabilityGrantFeature.cs

#LineLine coverage
 1namespace AsiBackbone.AspNetCore.Endpoints;
 2
 3/// <summary>
 4/// Request feature that records the capability grant an <see cref="IEndpointCapabilityGrantValidator" /> accepted for
 5/// the current endpoint governance evaluation.
 6/// </summary>
 7/// <remarks>
 8/// <see cref="DefaultEndpointGovernanceService" /> clears this feature before it calls the validator and, when audit is
 9/// requested, copies <see cref="GrantId" /> into the decision receipt's
 10/// <see cref="Core.Audit.IDecisionReceipt.CapabilityGrantId" />. <see cref="Core.Audit.AuditLedgerRecord.FromDecisionRe
 11/// then records it as <see cref="Core.Audit.AuditLedgerRecord.CapabilityTokenId" />. A validator should set the feature
 12/// after the grant was accepted, and never when it returns a denial.
 13/// </remarks>
 14public interface IEndpointCapabilityGrantFeature
 15{
 16    /// <summary>
 17    /// Gets the identifier of the accepted capability grant.
 18    /// </summary>
 19    string GrantId { get; }
 20}
 21
 22/// <summary>
 23/// Default <see cref="IEndpointCapabilityGrantFeature" /> implementation.
 24/// </summary>
 25public sealed class EndpointCapabilityGrantFeature : IEndpointCapabilityGrantFeature
 26{
 27    /// <summary>
 28    /// Initializes a new instance of the <see cref="EndpointCapabilityGrantFeature" /> class.
 29    /// </summary>
 30    /// <param name="grantId">The identifier of the accepted capability grant.</param>
 31    /// <exception cref="ArgumentException"><paramref name="grantId" /> is null, empty, or whitespace.</exception>
 1632    public EndpointCapabilityGrantFeature(string grantId)
 33    {
 1634        ArgumentException.ThrowIfNullOrWhiteSpace(grantId);
 1635        GrantId = grantId.Trim();
 1636    }
 37
 38    /// <inheritdoc />
 39    public string GrantId { get; }
 40}

Methods/Properties

.ctor(System.String)