< Summary

Information
Class: AsiBackbone.AspNetCore.Endpoints.EmitGovernanceAuditAttribute
Assembly: AsiBackbone.AspNetCore
File(s): /home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.AspNetCore/Endpoints/GovernancePolicyAttribute.cs
Line coverage
100%
Covered lines: 1
Uncovered lines: 0
Coverable lines: 1
Total lines: 90
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
get_EmitGovernanceAudit()100%11100%

File(s)

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

#LineLine coverage
 1namespace AsiBackbone.AspNetCore.Endpoints;
 2
 3/// <summary>
 4/// Marks an ASP.NET Core endpoint with the host-defined AsiBackbone policy type that governs it.
 5/// </summary>
 6/// <remarks>
 7/// <para>
 8/// The recorded type is a marker, not an enforcement rule. The framework does not resolve it or select constraints
 9/// from it: the registered policy evaluator evaluates every registered constraint on every governed endpoint,
 10/// whichever policy type an endpoint carries. Presence of this attribute is what causes policy evaluation to run at
 11/// all; the type identifies which policy the host intends, and reaches evaluation as the
 12/// <c>endpoint.policy_types</c> metadata entry where a host-supplied decision policy can read it. Marking two
 13/// endpoints with different policy types does not by itself make them evaluate differently.
 14/// </para>
 15/// <para>
 16/// Named <c>RequireGovernancePolicyAttribute</c> before 6.0. The route-builder extension of the same name became
 17/// <c>MarkGovernancePolicy</c> because "Require" overstated what the marker does; the attribute is renamed for the same
 18/// reason, so the attribute and route-builder paths use consistent vocabulary.
 19/// </para>
 20/// <para>
 21/// Initializes a new instance of the <see cref="GovernancePolicyAttribute" /> class.
 22/// </para>
 23/// </remarks>
 24/// <param name="policyType">The host-defined policy marker or decision policy type associated with the endpoint.</param
 25[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
 26public sealed class GovernancePolicyAttribute(Type policyType) : Attribute, IEndpointGovernancePolicyMetadata
 27{
 28
 29    /// <inheritdoc />
 30    public Type PolicyType { get; } = policyType ?? throw new ArgumentNullException(nameof(policyType));
 31}
 32
 33/// <summary>
 34/// Marks an ASP.NET Core endpoint as requesting latency-optimized fast-abort policy evaluation after the first denied c
 35/// </summary>
 36/// <remarks>
 37/// This metadata is resolved into the endpoint governance descriptor and exported into framework-neutral evaluation met
 38/// Hosts still own how endpoint metadata is mapped into evaluator configuration.
 39/// </remarks>
 40/// <remarks>
 41/// Initializes a new instance of the <see cref="ShortCircuitOnFirstDenialAttribute" /> class.
 42/// </remarks>
 43/// <param name="enabled">Whether first-denial short-circuit metadata is enabled for the endpoint.</param>
 44[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
 45public sealed class ShortCircuitOnFirstDenialAttribute(bool enabled = true) : Attribute, IEndpointPolicyEvaluationOption
 46{
 47
 48    /// <inheritdoc />
 49    public bool? ShortCircuitOnFirstDenial { get; } = enabled;
 50}
 51
 52/// <summary>
 53/// Marks an ASP.NET Core endpoint as requiring liability-handshake support when a governance decision requires acknowle
 54/// </summary>
 55[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
 56public sealed class RequireAcknowledgmentAttribute : Attribute, IEndpointAcknowledgmentMetadata
 57{
 58    /// <inheritdoc />
 59    public bool RequiresAcknowledgment => true;
 60}
 61
 62/// <summary>
 63/// Marks an ASP.NET Core endpoint as requiring a host-validated capability grant before execution.
 64/// </summary>
 65[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
 66public sealed class RequireCapabilityGrantAttribute : Attribute, IEndpointCapabilityGrantMetadata
 67{
 68    /// <summary>
 69    /// Initializes a new instance of the <see cref="RequireCapabilityGrantAttribute" /> class.
 70    /// </summary>
 71    /// <param name="scope">The required capability-grant scope.</param>
 72    public RequireCapabilityGrantAttribute(string scope)
 73    {
 74        ArgumentException.ThrowIfNullOrWhiteSpace(scope);
 75        Scope = scope.Trim();
 76    }
 77
 78    /// <inheritdoc />
 79    public string Scope { get; }
 80}
 81
 82/// <summary>
 83/// Marks an ASP.NET Core endpoint as requesting governance audit emission through the host-owned audit path.
 84/// </summary>
 85[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
 86public sealed class EmitGovernanceAuditAttribute : Attribute, IEndpointAuditEmissionMetadata
 87{
 88    /// <inheritdoc />
 789    public bool EmitGovernanceAudit => true;
 90}

Methods/Properties

get_EmitGovernanceAudit()