예제 #1
0
        private static void Configure(IServiceCollection services, IConfigurationRoot configuration)
        {
            services.AddTransient(x => DbContextStartup.Workflow(x, false));
            services.AddTransient(x => DbContextStartup.Content(x, false));
            services.AddTransient(x => DbContextStartup.Publishing(x, false));

            services.AddTransient <Func <WorkflowDbContext> >(x => x.GetService <WorkflowDbContext>);
            services.AddTransient <Func <PublishingJobDbContext> >(x => x.GetService <PublishingJobDbContext>);
            services.AddTransient <Func <ContentDbContext> >(x => x.GetService <ContentDbContext>);

            services.AddScoped <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();

            services.AddSingleton <IConfiguration>(configuration);
            services.AddSingleton <ITekValidatorConfig, TekValidatorConfig>();
            services.AddSingleton <IEksHeaderInfoConfig, EksHeaderInfoConfig>();
            services.AddSingleton <IEksConfig, StandardEksConfig>();

            services.AddTransient <ITransmissionRiskLevelCalculation, TransmissionRiskLevelCalculationV1>();
            services.AddTransient <ExposureKeySetBatchJobMk3>();
            services.AddTransient <IRandomNumberGenerator, StandardRandomNumberGenerator>();
            services.AddTransient <IEksStuffingGenerator, EksStuffingGenerator>();
            services.AddTransient <IPublishingIdService, Sha256HexPublishingIdService>();
            services.AddTransient <EksBuilderV1>();
            services.AddTransient <GeneratedProtobufEksContentFormatter>();
            services.AddTransient <IEksBuilder, EksBuilderV1>();
            services.AddTransient <IEksContentFormatter, GeneratedProtobufEksContentFormatter>();
            services.AddTransient <ISnapshotEksInput, SnapshotEksInputMk1>();
            services.AddTransient <IMarkWorkFlowTeksAsUsed, MarkWorkFlowTeksAsUsed>();
            services.AddTransient <EksJobContentWriter>();

            services.NlSignerStartup(configuration.UseCertificatesFromResources());
            services.GaSignerStartup(configuration.UseCertificatesFromResources());
        }
예제 #2
0
        private static void Configure(IServiceCollection services, IConfigurationRoot configuration)
        {
            services.AddSingleton <IConfiguration>(configuration);
            services.AddScoped <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();

            services.AddScoped(x => DbContextStartup.Workflow(x, false));
            services.AddScoped(x => DbContextStartup.Content(x, false));

            services.AddTransient <FillDatabasesCommand>();

            services.AddTransient <WorkflowDatabaseCreateCommand>();
            services.AddTransient <ContentDatabaseCreateCommand>();

            services.AddSingleton <IWorkflowConfig, WorkflowConfig>();
            services.AddSingleton <ITekValidatorConfig, TekValidatorConfig>();
            services.AddSingleton <IEksConfig, StandardEksConfig>();

            services.AddTransient <IRandomNumberGenerator, StandardRandomNumberGenerator>();
            services.AddTransient <ILabConfirmationIdService, LabConfirmationIdService>();
            services.AddTransient <IJsonSerializer, StandardJsonSerializer>();
            services.AddTransient <IPublishingIdService, Sha256HexPublishingIdService>();
            services.AddTransient <ContentValidator>();
            services.AddTransient <ContentInsertDbCommand>();

            services.AddTransient <ZippedSignedContentFormatter>();
            services.AddTransient <IContentSigner, CmsSignerEnhanced>();

            services.AddTransient <WriteFromFile>();
            services.AddTransient <ContentValidator>();
            services.AddTransient <ContentInsertDbCommand>();

            services.NlSignerStartup();
        }
예제 #3
0
 private static void Configure(IServiceCollection services, IConfigurationRoot configuration)
 {
     services.AddSingleton <IConfiguration>(configuration);
     services.AddScoped <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();
     services.AddScoped(x => DbContextStartup.Workflow(x, false));
     services.AddTransient <ForceTekAuthCommand>();
 }
예제 #4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddScoped(x => DbContextStartup.Workflow(x, false));
            services.AddScoped(x => DbContextStartup.Content(x, false));
            services.AddScoped(x => DbContextStartup.Publishing(x, false));

            services.AddTransient <ContentValidator>();
            services.AddTransient <ContentInsertDbCommand>();

            services.NlSignerStartup(_Configuration.UseCertificatesFromResources());
            services.GaSignerStartup(_Configuration.UseCertificatesFromResources());

            // Database Scoping
            services.AddScoped(x =>
            {
                var config  = new StandardEfDbConfig(_Configuration, "WorkFlow");
                var builder = new SqlServerDbContextOptionsBuilder(config);
                var result  = new WorkflowDbContext(builder.Build());
                result.BeginTransaction();
                return(result);
            });

            services.AddScoped <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();
            services.AddTransient <IPublishingIdService, Sha256HexPublishingIdService>();
            services.AddTransient <ZippedSignedContentFormatter>();

            services.AddControllersWithViews();
        }
예제 #5
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddLogging();

            services.AddControllers(options =>
            {
                options.RespectBrowserAcceptHeader = true;
            });

            services.AddLogging();

            services.AddScoped <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();

            services.AddScoped(x => DbContextStartup.Workflow(x, false));
            services.AddScoped(x => DbContextStartup.Content(x, false));
            services.AddScoped(x => DbContextStartup.Publishing(x, false));

            services.GaSignerStartup(_Configuration.UseCertificatesFromResources());
            services.NlSignerStartup(_Configuration.UseCertificatesFromResources());

            services.AddSingleton <IEksHeaderInfoConfig, EksHeaderInfoConfig>();
            services.AddSingleton <IEksConfig, StandardEksConfig>();
            services.AddSingleton <IWorkflowConfig, WorkflowConfig>();
            services.AddSingleton <ITekValidatorConfig, TekValidatorConfig>();

            services.AddTransient <ITransmissionRiskLevelCalculation, TransmissionRiskLevelCalculationV1>();
            services.AddTransient <ExposureKeySetBatchJobMk3>();
            services.AddTransient <IEksContentFormatter, GeneratedProtobufEksContentFormatter>();
            services.AddTransient <EksBuilderV1>();
            services.AddTransient <IPublishingIdService, Sha256HexPublishingIdService>();
            services.AddTransient <ManifestBatchJob>();
            services.AddTransient <ManifestBuilder>();
            services.AddTransient <ManifestBuilderAndFormatter>();
            services.AddTransient <IContentEntityFormatter, StandardContentEntityFormatter>();
            services.AddTransient <ZippedSignedContentFormatter>();
            services.AddTransient <IJsonSerializer, StandardJsonSerializer>();
            services.AddTransient <IEksBuilder, EksBuilderV1>();
            services.AddTransient <IEksStuffingGenerator, EksStuffingGenerator>();
            services.AddTransient <IRandomNumberGenerator, StandardRandomNumberGenerator>();
            services.AddTransient <WorkflowDatabaseCreateCommand>();
            services.AddTransient <PublishingJobDatabaseCreateCommand>();
            services.AddTransient <ContentDatabaseCreateCommand>();
            services.AddTransient <ProvisionDatabasesCommand>();
            services.AddTransient <IPublishingIdService, Sha256HexPublishingIdService>();
            services.AddTransient <ContentValidator>();
            services.AddTransient <ContentInsertDbCommand>();
            services.AddTransient <ZippedSignedContentFormatter>();
            services.AddTransient <ILabConfirmationIdService, LabConfirmationIdService>();

            services.AddSwaggerGen(o =>
            {
                o.SwaggerDoc("v1", new OpenApiInfo {
                    Title = Title, Version = "v1"
                });
            });
        }
        public void ConfigureServices(IServiceCollection services)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            services.Configure <ForwardedHeadersOptions>(options =>
            {
                options.ForwardedHeaders =
                    ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto | ForwardedHeaders.XForwardedHost;
            });

            services.AddControllers(options => { options.RespectBrowserAcceptHeader = true; });

            services.AddScoped <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();

            services.AddScoped(x => DbContextStartup.Workflow(x));
            services.AddScoped <HttpPostAuthoriseCommand>();
            services.AddScoped <HttpPostLabVerifyCommand>();
            services.AddScoped <HttpGetLogoutCommand>();
            services.AddScoped <HttpGetUserClaimCommand>();
            services.AddScoped <HttpGetAuthorisationRedirectCommand>();
            services.AddScoped <HttpGetAccessDeniedCommand>();

            services.AddSingleton <IIccPortalConfig, IccPortalConfig>();

            services.AddTransient <IJsonSerializer, StandardJsonSerializer>();
            services.AddTransient <AuthorisationArgsValidator>();
            services.AddTransient <LabVerifyArgsValidator>();
            services.AddTransient <AuthorisationWriterCommand>();
            services.AddTransient <IRandomNumberGenerator, StandardRandomNumberGenerator>();
            services.AddTransient <IJwtService, JwtService>();
            services.AddTransient <WriteNewPollTokenWriter>();
            services.AddTransient <PollTokenService>();
            services.AddTransient <ILabConfirmationIdService, LabConfirmationIdService>();

            services.AddCors();

            if (_IsDev)
            {
                services.AddSwaggerGen(StartupSwagger);
            }

            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

            StartupIdentityHub(services);

            StartupAuthenticationScheme(services.AddAuthentication(JwtAuthenticationHandler.SchemeName));
        }
예제 #7
0
        private static void Configure(IServiceCollection services, IConfigurationRoot configuration)
        {
            services.AddTransient(x => DbContextStartup.Workflow(x, false));
            services.AddTransient(x => DbContextStartup.Content(x, false));
            services.AddTransient(x => DbContextStartup.Publishing(x, false));
            services.AddTransient(x => DbContextStartup.Stats(x, false));

            services.AddTransient <Func <WorkflowDbContext> >(x => x.GetService <WorkflowDbContext>);
            services.AddTransient <Func <PublishingJobDbContext> >(x => x.GetService <PublishingJobDbContext>);
            services.AddTransient <Func <ContentDbContext> >(x => x.GetService <ContentDbContext>);

            services.AddScoped <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();

            services.AddSingleton <IConfiguration>(configuration);
            services.AddSingleton <ITekValidatorConfig, TekValidatorConfig>();
            services.AddSingleton <IEksHeaderInfoConfig, EksHeaderInfoConfig>();
            services.AddSingleton <IEksConfig, StandardEksConfig>();

            services.AddTransient <ITransmissionRiskLevelCalculation, TransmissionRiskLevelCalculationV1>();
            services.AddTransient <ExposureKeySetBatchJobMk3>();
            services.AddTransient <IRandomNumberGenerator, StandardRandomNumberGenerator>();
            services.AddTransient <IEksStuffingGenerator, EksStuffingGenerator>();
            services.AddTransient <IPublishingIdService, Sha256HexPublishingIdService>();
            services.AddTransient <EksBuilderV1>();
            services.AddTransient <GeneratedProtobufEksContentFormatter>();
            services.AddTransient <IEksBuilder, EksBuilderV1>();
            services.AddTransient <IEksContentFormatter, GeneratedProtobufEksContentFormatter>();
            services.AddTransient <ISnapshotEksInput, SnapshotEksInputMk1>();
            services.AddTransient <IMarkWorkFlowTeksAsUsed, MarkWorkFlowTeksAsUsed>();
            services.AddTransient <EksJobContentWriter>();

            services.AddTransient <ManifestUpdateCommand>();
            services.AddTransient <IJsonSerializer, StandardJsonSerializer>();

            services.AddTransient <ManifestBuilder>();
            services.AddTransient <IContentEntityFormatter, StandardContentEntityFormatter>();
            services.AddTransient <ZippedSignedContentFormatter>();

            services.AddTransient <RemoveExpiredManifestsCommand>();
            services.AddTransient <RemoveExpiredManifestsV2Command>();
            services.AddTransient <RemoveExpiredEksCommand>();
            services.AddTransient <RemoveExpiredEksV2Command>();
            services.AddTransient <RemoveExpiredWorkflowsCommand>();

            services.AddSingleton <IManifestConfig, ManifestConfig>();
            services.AddSingleton <IWorkflowConfig, WorkflowConfig>();

            services.NlResignerStartup();

            services.DummySignerStartup();
            services.GaSignerStartup();

            services.DailyStatsStartup();
        }
예제 #8
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddScoped <IJsonSerializer, StandardJsonSerializer>();

            services.AddControllers();

            services.AddScoped <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();
            services.AddScoped(x => DbContextStartup.Workflow(x));

            services.AddScoped <HttpPostReleaseTeksCommand2>();
            services.AddScoped <HttpPostRegisterSecret>();
            services.AddScoped <HttpPostDecoyKeysCommand>();

            services.AddSingleton <ITekListValidationConfig, StandardTekListValidationConfig>();
            services.AddSingleton <ITekValidatorConfig, TekValidatorConfig>();
            services.AddSingleton <IDecoyKeysConfig, StandardDecoyKeysConfig>();
            services.AddSingleton <IWorkflowConfig, WorkflowConfig>();

            if (_Configuration.ValidatePostKeysSignature())
            {
                services.AddTransient <ISignatureValidator, SignatureValidator>();
            }
            else
            {
                services.AddTransient <ISignatureValidator, DoNotValidateSignatureValidator>();
            }

            services.AddTransient <IWorkflowTime, TekReleaseWorkflowTime>();
            services.AddTransient <IPostTeksValidator, PostTeksArgsValidator>();
            services.AddTransient <ITemporaryExposureKeyValidator, TemporaryExposureKeyValidator>();
            services.AddTransient <ITekListWorkflowFilter, BackwardCompatibleV15TekListWorkflowFilter>();
            services.AddTransient <ILabConfirmationIdService, LabConfirmationIdService>();
            services.AddTransient <ISecretWriter, TekReleaseWorkflowStateCreate>();
            services.AddTransient <ITekWriter, TekWriter>();
            services.AddTransient <IRandomNumberGenerator, StandardRandomNumberGenerator>();
            services.AddTransient <ILabConfirmationIdFormatter, StandardLabConfirmationIdFormatter>();

            services.AddScoped <ResponsePaddingFilterAttribute>();
            services.AddScoped <IResponsePaddingConfig, ResponsePaddingConfig>();
            services.AddScoped <IPaddingGenerator, CryptoRandomPaddingGenerator>();

            services.AddSwaggerGen(o => { o.SwaggerDoc("v1", new OpenApiInfo {
                    Title = Title, Version = "v1"
                }); });
        }
        private static void Configure(IServiceCollection services, IConfigurationRoot configuration)
        {
            services.AddTransient <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();
            services.AddSingleton(x => DbContextStartup.Workflow(x, false));

            services.AddSingleton <IConfiguration>(configuration);
            services.AddSingleton <ILabConfirmationIdService, LabConfirmationIdService>();
            services.AddSingleton <IRandomNumberGenerator, StandardRandomNumberGenerator>();
            services.AddSingleton <IWorkflowConfig, WorkflowConfig>();

            services.AddTransient(x => new GenerateTeksCommand(
                                      x.GetRequiredService <IRandomNumberGenerator>(),
                                      x.GetRequiredService <WorkflowDbContext>(),
                                      x.GetRequiredService <TekReleaseWorkflowStateCreate>
                                      ));

            services.AddTransient <TekReleaseWorkflowStateCreate>();

            services.AddTransient <IWorkflowTime, TekReleaseWorkflowTime>();
        }
예제 #10
0
        public void ConfigureServices(IServiceCollection services)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            services.Configure <ForwardedHeadersOptions>(options =>
            {
                options.ForwardedHeaders =
                    ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto | ForwardedHeaders.XForwardedHost;
            });

            services.AddControllers(options => { options.RespectBrowserAcceptHeader = true; });

            services.AddTransient <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();

            services.AddTransient <IRandomNumberGenerator, StandardRandomNumberGenerator>();

            services.AddTransient <IAuthCodeGenerator, AuthCodeGenerator>();
            services.AddSingleton <IAuthCodeService, AuthCodeService>();

            services.AddDistributedSqlServerCache(options =>
            {
                options.ConnectionString = _Configuration.GetConnectionString(DatabaseConnectionStringNames.IccDistMemCache);
                options.SchemaName       = "dbo";
                options.TableName        = "Cache";
            });

            services.AddScoped(x => DbContextStartup.DataProtectionKeys(x));
            services.AddDataProtection()
            .PersistKeysToDbContext <DataProtectionKeysDbContext>();

            services.AddScoped(x => DbContextStartup.Workflow(x));
            services.AddScoped <HttpPostAuthoriseCommand>();
            services.AddScoped <HttpGetLogoutCommand>();
            services.AddScoped <HttpGetUserClaimCommand>();
            services.AddScoped <HttpPostAuthorizationTokenCommand>();
            services.AddScoped <HttpGetAuthorisationRedirectCommand>();
            services.AddScoped <HttpGetAccessDeniedCommand>();


            services.AddSingleton <IIccPortalConfig, IccPortalConfig>();

            services.AddTransient <IJsonSerializer, StandardJsonSerializer>();
            services.AddTransient <AuthorisationArgsValidator>();
            services.AddTransient <AuthorisationWriterCommand>();


            services.AddTransient <IJwtService, JwtService>();

            if (_UseTestJwtClaims)
            {
                services.AddTransient <IJwtClaimValidator, TestJwtClaimValidator>();
                services.AddSingleton <TestJwtGeneratorService>();
            }
            else
            {
                services.AddTransient <IJwtClaimValidator, JwtClaimValidator>();
            }

            services.AddTransient <WriteNewPollTokenWriter>();
            services.AddTransient <IPollTokenService, PollTokenService>();
            services.AddTransient <ILabConfirmationIdService, LabConfirmationIdService>();
            services.AddCors();

            if (_IsDev)
            {
                services.AddSwaggerGen(StartupSwagger);
            }

            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

            StartupIdentityHub(services);

            StartupAuthenticationScheme(services.AddAuthentication(JwtAuthenticationHandler.SchemeName));
        }