feat(infrastructure): add PKCS#11 PDF signing infrastructure
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using DocumentOperator.Application.Common.Configurations;
|
||||
using DocumentOperator.Application.Common.Interfaces.Services;
|
||||
using DocumentService.Infrastructure.Crypt.Services;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace DocumentService.Infrastructure.Crypt.DependencyInjection;
|
||||
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
public static IServiceCollection AddCryptInfrastructure(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services
|
||||
.AddOptions<Pkcs11Options>()
|
||||
.Bind(configuration.GetSection(Pkcs11Options.SectionName))
|
||||
.ValidateDataAnnotations()
|
||||
.ValidateOnStart();
|
||||
|
||||
services.AddSingleton<IPdfDigitalSignatureService, PdfDigitalSignatureService>();
|
||||
services.AddSingleton<Pkcs11SelfTestStatusStore>();
|
||||
services.AddSingleton<IPkcs11SelfTestStatusProvider>(sp => sp.GetRequiredService<Pkcs11SelfTestStatusStore>());
|
||||
services.AddHostedService<Pkcs11StartupSelfTestHostedService>();
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user