| | | 1 | | namespace AsiBackbone.AspNetCore.Endpoints; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Marks an ASP.NET Core endpoint as requiring host-defined AsiBackbone governance policy evaluation. |
| | | 5 | | /// </summary> |
| | | 6 | | /// <remarks> |
| | | 7 | | /// Initializes a new instance of the <see cref="RequireGovernancePolicyAttribute" /> class. |
| | | 8 | | /// </remarks> |
| | | 9 | | /// <param name="policyType">The host-defined policy marker or resolver type associated with the endpoint.</param> |
| | | 10 | | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)] |
| | 19 | 11 | | public sealed class RequireGovernancePolicyAttribute(Type policyType) : Attribute, IAsiBackboneEndpointGovernancePolicyM |
| | | 12 | | { |
| | | 13 | | |
| | | 14 | | /// <inheritdoc /> |
| | 36 | 15 | | public Type PolicyType { get; } = policyType ?? throw new ArgumentNullException(nameof(policyType)); |
| | | 16 | | } |
| | | 17 | | |
| | | 18 | | /// <summary> |
| | | 19 | | /// Marks an ASP.NET Core endpoint as requesting latency-optimized fast-abort policy evaluation after the first denied c |
| | | 20 | | /// </summary> |
| | | 21 | | /// <remarks> |
| | | 22 | | /// This metadata is resolved into the endpoint governance descriptor and exported into framework-neutral evaluation met |
| | | 23 | | /// Hosts still own how endpoint metadata is mapped into evaluator configuration. |
| | | 24 | | /// </remarks> |
| | | 25 | | /// <remarks> |
| | | 26 | | /// Initializes a new instance of the <see cref="ShortCircuitOnFirstDenialAttribute" /> class. |
| | | 27 | | /// </remarks> |
| | | 28 | | /// <param name="enabled">Whether first-denial short-circuit metadata is enabled for the endpoint.</param> |
| | | 29 | | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] |
| | | 30 | | public sealed class ShortCircuitOnFirstDenialAttribute(bool enabled = true) : Attribute, IAsiBackboneEndpointPolicyEvalu |
| | | 31 | | { |
| | | 32 | | |
| | | 33 | | /// <inheritdoc /> |
| | | 34 | | public bool? ShortCircuitOnFirstDenial { get; } = enabled; |
| | | 35 | | } |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// Marks an ASP.NET Core endpoint as requiring liability-handshake support when a governance decision requires acknowle |
| | | 39 | | /// </summary> |
| | | 40 | | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] |
| | | 41 | | public sealed class RequireLiabilityHandshakeAttribute : Attribute, IAsiBackboneEndpointLiabilityHandshakeMetadata |
| | | 42 | | { |
| | | 43 | | /// <inheritdoc /> |
| | | 44 | | public bool RequiresLiabilityHandshake => true; |
| | | 45 | | } |
| | | 46 | | |
| | | 47 | | /// <summary> |
| | | 48 | | /// Marks an ASP.NET Core endpoint as requiring a host-validated capability grant before execution. |
| | | 49 | | /// </summary> |
| | | 50 | | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)] |
| | | 51 | | public sealed class RequireCapabilityGrantAttribute : Attribute, IAsiBackboneEndpointCapabilityGrantMetadata |
| | | 52 | | { |
| | | 53 | | /// <summary> |
| | | 54 | | /// Initializes a new instance of the <see cref="RequireCapabilityGrantAttribute" /> class. |
| | | 55 | | /// </summary> |
| | | 56 | | /// <param name="scope">The required capability-grant scope.</param> |
| | | 57 | | public RequireCapabilityGrantAttribute(string scope) |
| | | 58 | | { |
| | | 59 | | ArgumentException.ThrowIfNullOrWhiteSpace(scope); |
| | | 60 | | Scope = scope.Trim(); |
| | | 61 | | } |
| | | 62 | | |
| | | 63 | | /// <inheritdoc /> |
| | | 64 | | public string Scope { get; } |
| | | 65 | | } |
| | | 66 | | |
| | | 67 | | /// <summary> |
| | | 68 | | /// Marks an ASP.NET Core endpoint as requesting governance audit emission through the host-owned audit path. |
| | | 69 | | /// </summary> |
| | | 70 | | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] |
| | | 71 | | public sealed class EmitGovernanceAuditAttribute : Attribute, IAsiBackboneEndpointAuditEmissionMetadata |
| | | 72 | | { |
| | | 73 | | /// <inheritdoc /> |
| | | 74 | | public bool EmitGovernanceAudit => true; |
| | | 75 | | } |