| | | 1 | | using AsiBackbone.AspNetCore.Outbox; |
| | | 2 | | using AsiBackbone.DependencyInjection; |
| | | 3 | | |
| | | 4 | | namespace AsiBackbone.AspNetCore.DependencyInjection; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// Provides explicit builder facade extension methods for ASP.NET Core host integration. |
| | | 8 | | /// </summary> |
| | | 9 | | public static class AsiBackboneAspNetCoreBuilderExtensions |
| | | 10 | | { |
| | | 11 | | /// <summary> |
| | | 12 | | /// Adds ASP.NET Core endpoint governance services through the AsiBackbone builder facade using default options. |
| | | 13 | | /// </summary> |
| | | 14 | | public static IAsiBackboneBuilder UseAspNetCoreEndpointGovernance(this IAsiBackboneBuilder builder) |
| | | 15 | | { |
| | 2 | 16 | | return builder.UseAspNetCoreEndpointGovernance(_ => { }); |
| | | 17 | | } |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Adds ASP.NET Core endpoint governance services through the AsiBackbone builder facade using configured options. |
| | | 21 | | /// </summary> |
| | | 22 | | public static IAsiBackboneBuilder UseAspNetCoreEndpointGovernance( |
| | | 23 | | this IAsiBackboneBuilder builder, |
| | | 24 | | Action<AspNetCoreGovernanceOptions> configure) |
| | | 25 | | { |
| | 4 | 26 | | ArgumentNullException.ThrowIfNull(builder); |
| | 3 | 27 | | ArgumentNullException.ThrowIfNull(configure); |
| | | 28 | | |
| | 2 | 29 | | _ = builder.Services.AddAsiBackboneAspNetCore(configure); |
| | 2 | 30 | | return builder; |
| | | 31 | | } |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// Opts in to signed capability grant endpoint validation through the AsiBackbone builder facade. |
| | | 35 | | /// </summary> |
| | | 36 | | /// <remarks> |
| | | 37 | | /// See <see cref="AsiBackboneSignedCapabilityGrantServiceCollectionExtensions.AddAsiBackboneSignedCapabilityGrants" |
| | | 38 | | /// for the services the host must also supply. |
| | | 39 | | /// </remarks> |
| | | 40 | | public static IAsiBackboneBuilder UseSignedCapabilityGrants( |
| | | 41 | | this IAsiBackboneBuilder builder, |
| | | 42 | | Action<CapabilityGrants.SignedCapabilityGrantOptions> configure) |
| | | 43 | | { |
| | 0 | 44 | | ArgumentNullException.ThrowIfNull(builder); |
| | 0 | 45 | | ArgumentNullException.ThrowIfNull(configure); |
| | | 46 | | |
| | 0 | 47 | | _ = builder.Services.AddAsiBackboneSignedCapabilityGrants(configure); |
| | 0 | 48 | | return builder; |
| | | 49 | | } |
| | | 50 | | |
| | | 51 | | /// <summary> |
| | | 52 | | /// Adds the form-field capability grant request-binding provider through the AsiBackbone builder facade. |
| | | 53 | | /// </summary> |
| | | 54 | | public static IAsiBackboneBuilder UseFormFieldCapabilityGrantBinding( |
| | | 55 | | this IAsiBackboneBuilder builder, |
| | | 56 | | Action<CapabilityGrants.FormFieldCapabilityGrantBindingOptions>? configure = null) |
| | | 57 | | { |
| | 0 | 58 | | ArgumentNullException.ThrowIfNull(builder); |
| | | 59 | | |
| | 0 | 60 | | _ = builder.Services.AddAsiBackboneFormFieldCapabilityGrantBinding(configure); |
| | 0 | 61 | | return builder; |
| | | 62 | | } |
| | | 63 | | |
| | | 64 | | /// <summary> |
| | | 65 | | /// Adds the host-owned outbox drain worker through the AsiBackbone builder facade using default options. |
| | | 66 | | /// </summary> |
| | | 67 | | public static IAsiBackboneBuilder UseGovernanceOutboxDrain(this IAsiBackboneBuilder builder) |
| | | 68 | | { |
| | 2 | 69 | | return builder.UseGovernanceOutboxDrain(_ => { }); |
| | | 70 | | } |
| | | 71 | | |
| | | 72 | | /// <summary> |
| | | 73 | | /// Adds the host-owned outbox drain worker through the AsiBackbone builder facade using configured options. |
| | | 74 | | /// </summary> |
| | | 75 | | public static IAsiBackboneBuilder UseGovernanceOutboxDrain( |
| | | 76 | | this IAsiBackboneBuilder builder, |
| | | 77 | | Action<GovernanceOutboxDrainWorkerOptions> configure) |
| | | 78 | | { |
| | 4 | 79 | | ArgumentNullException.ThrowIfNull(builder); |
| | 3 | 80 | | ArgumentNullException.ThrowIfNull(configure); |
| | | 81 | | |
| | 2 | 82 | | _ = builder.Services.AddAsiBackboneGovernanceOutboxDrainWorker(configure); |
| | 2 | 83 | | return builder; |
| | | 84 | | } |
| | | 85 | | } |