- Created SignerEndpointsTests to validate the SignDsse and VerifyReferrers endpoints. - Implemented StubBearerAuthenticationDefaults and StubBearerAuthenticationHandler for token-based authentication. - Developed ConcelierExporterClient for managing Trivy DB settings and export operations. - Added TrivyDbSettingsPageComponent for UI interactions with Trivy DB settings, including form handling and export triggering. - Implemented styles and HTML structure for Trivy DB settings page. - Created NotifySmokeCheck tool for validating Redis event streams and Notify deliveries.
45 lines
1.6 KiB
C#
45 lines
1.6 KiB
C#
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Microsoft.Extensions.Logging;
|
|
using Microsoft.Extensions.Options;
|
|
using StellaOps.Authority.Plugin.Standard.Storage;
|
|
|
|
namespace StellaOps.Authority.Plugin.Standard.Bootstrap;
|
|
|
|
internal sealed class StandardPluginBootstrapper : IHostedService
|
|
{
|
|
private readonly string pluginName;
|
|
private readonly IServiceScopeFactory scopeFactory;
|
|
private readonly ILogger<StandardPluginBootstrapper> logger;
|
|
|
|
public StandardPluginBootstrapper(
|
|
string pluginName,
|
|
IServiceScopeFactory scopeFactory,
|
|
ILogger<StandardPluginBootstrapper> logger)
|
|
{
|
|
this.pluginName = pluginName;
|
|
this.scopeFactory = scopeFactory;
|
|
this.logger = logger;
|
|
}
|
|
|
|
public async Task StartAsync(CancellationToken cancellationToken)
|
|
{
|
|
using var scope = scopeFactory.CreateScope();
|
|
var optionsMonitor = scope.ServiceProvider.GetRequiredService<IOptionsMonitor<StandardPluginOptions>>();
|
|
var credentialStore = scope.ServiceProvider.GetRequiredService<StandardUserCredentialStore>();
|
|
|
|
var options = optionsMonitor.Get(pluginName);
|
|
if (options.BootstrapUser is null || !options.BootstrapUser.IsConfigured)
|
|
{
|
|
return;
|
|
}
|
|
|
|
logger.LogInformation("Standard Authority plugin '{PluginName}' ensuring bootstrap user.", pluginName);
|
|
await credentialStore.EnsureBootstrapUserAsync(options.BootstrapUser, cancellationToken).ConfigureAwait(false);
|
|
}
|
|
|
|
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
|
|
}
|