MdpIngestServiceCollectionExtensions.cs 1.1 KB

12345678910111213141516171819202122
  1. using Microsoft.AspNetCore.Authentication;
  2. using Microsoft.Extensions.DependencyInjection;
  3. namespace Admin.NET.Plugin.AiDOP.DataPlatform.UnifiedIngress;
  4. public static class MdpIngestServiceCollectionExtensions
  5. {
  6. public static IServiceCollection AddMdpUnifiedIngress(this IServiceCollection services)
  7. {
  8. services.AddTransient<MdpIngestReceiveService>();
  9. services.AddTransient<MdpIngestBatchStatusService>();
  10. services.AddScoped<MdpIngestAdmissionStore>();
  11. services.AddSingleton<MdpIngestExternalIdentities>();
  12. services.AddHttpClient(MdpIngestExternalIdentities.MetadataClient, client => client.Timeout = TimeSpan.FromSeconds(8))
  13. .ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler { AllowAutoRedirect = false });
  14. services.AddScoped<ISecretStore, MdpIngestSecretStore>();
  15. services.AddSingleton<IMdpIngestSecretProvider, EnvironmentMdpIngestSecretProvider>();
  16. services.AddAuthentication().AddScheme<AuthenticationSchemeOptions, MdpIngestAuthenticationHandler>(
  17. MdpIngestProtocol.AuthenticationScheme, _ => { });
  18. return services;
  19. }
  20. }