< Summary

Information
Class: AsiBackbone.AspNetCore.DependencyInjection.AsiBackboneRegulatedGovernanceServiceCollectionExtensions
Assembly: AsiBackbone.AspNetCore
File(s): /home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.AspNetCore/DependencyInjection/AsiBackboneRegulatedGovernanceServiceCollectionExtensions.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 58
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
AddAsiBackboneRegulatedGovernance(...)100%11100%
UseRegulatedGovernanceProfile(...)100%11100%

File(s)

/home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.AspNetCore/DependencyInjection/AsiBackboneRegulatedGovernanceServiceCollectionExtensions.cs

#LineLine coverage
 1using AsiBackbone.Core.Metadata;
 2using AsiBackbone.DependencyInjection;
 3using Microsoft.Extensions.DependencyInjection;
 4using Microsoft.Extensions.DependencyInjection.Extensions;
 5
 6namespace AsiBackbone.AspNetCore.DependencyInjection;
 7
 8/// <summary>
 9/// Provides regulated-governance registration helpers for hosts that want a repeatable, fail-closed ASP.NET Core postur
 10/// </summary>
 11public static class AsiBackboneRegulatedGovernanceServiceCollectionExtensions
 12{
 13    /// <summary>
 14    /// Adds ASP.NET Core endpoint governance, applies the strict governance option profile, and registers the
 15    /// provider-neutral governance metadata sanitation pipeline.
 16    /// </summary>
 17    /// <param name="services">The service collection to configure.</param>
 18    /// <returns>The same service collection so calls can be chained.</returns>
 19    /// <exception cref="ArgumentNullException">
 20    /// Thrown when <paramref name="services" /> is <see langword="null" />.
 21    /// </exception>
 22    /// <remarks>
 23    /// This helper establishes a conservative governance posture; it is not a legal or regulatory compliance
 24    /// certification. Hosts still own authentication, authorization, policy and threat-model registrations,
 25    /// capability proof verification, durable replay/use tracking, metadata classifiers, durable audit and outbox
 26    /// persistence, managed-key signing, monitoring, retention, and final execution enforcement.
 27    /// </remarks>
 28    public static IServiceCollection AddAsiBackboneRegulatedGovernance(this IServiceCollection services)
 29    {
 430        ArgumentNullException.ThrowIfNull(services);
 31
 332        _ = services.AddAsiBackboneAspNetCore();
 333        _ = services.AddAsiBackboneStrictGovernance();
 34
 335        services.TryAddScoped<IGovernanceMetadataSanitizer>(serviceProvider =>
 636            new DefaultGovernanceMetadataSanitizer(
 637                serviceProvider.GetServices<IGovernanceMetadataClassifier>(),
 638                GovernanceMetadataBudget.Recommended));
 39
 340        return services;
 41    }
 42
 43    /// <summary>
 44    /// Applies the regulated governance profile through the explicit <c>AddAsiBackbone</c> builder facade.
 45    /// </summary>
 46    /// <param name="builder">The AsiBackbone builder facade being configured.</param>
 47    /// <returns>The same builder so calls can be chained.</returns>
 48    /// <exception cref="ArgumentNullException">
 49    /// Thrown when <paramref name="builder" /> is <see langword="null" />.
 50    /// </exception>
 51    public static IAsiBackboneBuilder UseRegulatedGovernanceProfile(this IAsiBackboneBuilder builder)
 52    {
 153        ArgumentNullException.ThrowIfNull(builder);
 54
 155        _ = builder.Services.AddAsiBackboneRegulatedGovernance();
 156        return builder;
 57    }
 58}