stabilizaiton work - projects rework for maintenanceability and ui livening
This commit is contained in:
@@ -9,3 +9,4 @@ Source of truth: `docs-archived/implplan/2025-12-29-csproj-audit/SPRINT_20251229
|
||||
| AUDIT-0067-T | DONE | Revalidated 2026-01-08; open findings tracked in audit report. |
|
||||
| AUDIT-0067-A | TODO | Revalidated 2026-01-08 (open findings). |
|
||||
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |
|
||||
| REMED-08 | DONE | Split WineCspProvider; added DI registration/fallback logging tests. |
|
||||
|
||||
@@ -1,35 +1,10 @@
|
||||
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using StellaOps.Cryptography;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace StellaOps.Cryptography.Plugin.WineCsp;
|
||||
|
||||
/// <summary>
|
||||
/// Options for configuring the WineCSP provider shim.
|
||||
/// </summary>
|
||||
public sealed record WineCspProviderOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Optional base address for a WineCSP sidecar (HTTP) endpoint.
|
||||
/// </summary>
|
||||
public string BaseAddress { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Optional request timeout when calling a WineCSP sidecar.
|
||||
/// </summary>
|
||||
public TimeSpan Timeout { get; init; } = TimeSpan.FromSeconds(30);
|
||||
|
||||
/// <summary>
|
||||
/// Provider identifier injected into the registry.
|
||||
/// </summary>
|
||||
public string ProviderName { get; init; } = "ru.winecsp.http";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Minimal shim provider to keep registry wiring stable when WineCSP binaries are absent.
|
||||
/// Delegates to the default crypto provider so callers receive deterministic behaviour.
|
||||
@@ -82,29 +57,8 @@ public sealed class WineCspProvider : ICryptoProvider
|
||||
|
||||
private void LogIfInvoked()
|
||||
{
|
||||
_logger?.LogWarning("WineCSP provider invoked using fallback implementation; WineCSP sidecar not present (BaseAddress: {BaseAddress}).", _options.BaseAddress);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registration helpers for the WineCSP provider shim.
|
||||
/// </summary>
|
||||
public static class WineCspServiceCollectionExtensions
|
||||
{
|
||||
public static IServiceCollection AddWineCspProvider(
|
||||
this IServiceCollection services,
|
||||
Action<WineCspProviderOptions>? configure = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(services);
|
||||
|
||||
services.AddOptions<WineCspProviderOptions>();
|
||||
if (configure is not null)
|
||||
{
|
||||
services.Configure(configure);
|
||||
}
|
||||
|
||||
services.TryAddSingleton<WineCspProvider>();
|
||||
services.TryAddEnumerable(ServiceDescriptor.Singleton<ICryptoProvider, WineCspProvider>());
|
||||
return services;
|
||||
_logger?.LogWarning(
|
||||
"WineCSP provider invoked using fallback implementation; WineCSP sidecar not present (BaseAddress: {BaseAddress}).",
|
||||
_options.BaseAddress);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace StellaOps.Cryptography.Plugin.WineCsp;
|
||||
|
||||
/// <summary>
|
||||
/// Options for configuring the WineCSP provider shim.
|
||||
/// </summary>
|
||||
public sealed record WineCspProviderOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Optional base address for a WineCSP sidecar (HTTP) endpoint.
|
||||
/// </summary>
|
||||
public string BaseAddress { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Optional request timeout when calling a WineCSP sidecar.
|
||||
/// </summary>
|
||||
public TimeSpan Timeout { get; init; } = TimeSpan.FromSeconds(30);
|
||||
|
||||
/// <summary>
|
||||
/// Provider identifier injected into the registry.
|
||||
/// </summary>
|
||||
public string ProviderName { get; init; } = "ru.winecsp.http";
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using StellaOps.Cryptography;
|
||||
using System;
|
||||
|
||||
namespace StellaOps.Cryptography.Plugin.WineCsp;
|
||||
|
||||
/// <summary>
|
||||
/// Registration helpers for the WineCSP provider shim.
|
||||
/// </summary>
|
||||
public static class WineCspServiceCollectionExtensions
|
||||
{
|
||||
public static IServiceCollection AddWineCspProvider(
|
||||
this IServiceCollection services,
|
||||
Action<WineCspProviderOptions>? configure = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(services);
|
||||
|
||||
services.AddOptions<WineCspProviderOptions>();
|
||||
if (configure is not null)
|
||||
{
|
||||
services.Configure(configure);
|
||||
}
|
||||
|
||||
services.TryAddSingleton<WineCspProvider>();
|
||||
services.TryAddEnumerable(ServiceDescriptor.Singleton<ICryptoProvider, WineCspProvider>());
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user