Beispiel #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            ComponentsContainerHelper.RegisterDefaultServices(services);

            services.AddSeriLog(Configuration);

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

            services.AddScoped(x =>
            {
                var config  = new StandardEfDbConfig(Configuration, "Content");
                var builder = new SqlServerDbContextOptionsBuilder(config);
                var result  = new ExposureContentDbContext(builder.Build());
                result.BeginTransaction();
                return(result);
            });

            services.AddSingleton <IUtcDateTimeProvider>(new StandardUtcDateTimeProvider());
            services.AddSingleton <IPublishingId, StandardPublishingIdFormatter>();

            services.AddScoped <HttpGetCdnManifestCommand, HttpGetCdnManifestCommand>();
            services.AddScoped <HttpGetCdnContentCommand <AppConfigContentEntity>, HttpGetCdnContentCommand <AppConfigContentEntity> >();
            services.AddScoped <HttpGetCdnContentCommand <ResourceBundleContentEntity>, HttpGetCdnContentCommand <ResourceBundleContentEntity> >();
            services.AddScoped <HttpGetCdnContentCommand <RiskCalculationContentEntity>, HttpGetCdnContentCommand <RiskCalculationContentEntity> >();
            services.AddScoped <HttpGetCdnContentCommand <ExposureKeySetContentEntity>, HttpGetCdnContentCommand <ExposureKeySetContentEntity> >();

            services.AddScoped <IReader <ManifestEntity>, SafeBinaryContentDbReader <ManifestEntity> >();
            services.AddScoped <IReader <AppConfigContentEntity>, SafeBinaryContentDbReader <AppConfigContentEntity> >();
            services.AddScoped <IReader <ResourceBundleContentEntity>, SafeBinaryContentDbReader <ResourceBundleContentEntity> >();
            services.AddScoped <IReader <RiskCalculationContentEntity>, SafeBinaryContentDbReader <RiskCalculationContentEntity> >();
            services.AddScoped <IReader <ExposureKeySetContentEntity>, SafeBinaryContentDbReader <ExposureKeySetContentEntity> >();
        }
 public CreateContentDatabase(ExposureContentDbContext dbContextProvider, IUtcDateTimeProvider dateTimeProvider, IContentSigner signer, IJsonSerializer jsonSerializer)
 {
     _DbContextProvider = dbContextProvider;
     _DateTimeProvider  = dateTimeProvider;
     _Formatter         = new StandardContentEntityFormatter(new ZippedSignedContentFormatter(signer), new StandardPublishingIdFormatter());
     _JsonSerializer    = jsonSerializer;
 }
Beispiel #3
0
        public static void ConfigureServices(IServiceCollection services)
        {
            services.AddSeriLog(Configuration);
            services.AddSingleton(Configuration);
            services.AddTransient <App>();

            services.AddScoped(x =>
            {
                var config  = new StandardEfDbConfig(Configuration, "Content");
                var builder = new SqlServerDbContextOptionsBuilder(config);
                var result  = new ExposureContentDbContext(builder.Build());
                return(result);
            });

            services.AddScoped(x =>
            {
                var config  = new StandardEfDbConfig(Configuration, "Workflow");
                var builder = new SqlServerDbContextOptionsBuilder(config);
                var result  = new WorkflowDbContext(builder.Build());
                return(result);
            });

            services.AddScoped(x =>
            {
                var config  = new StandardEfDbConfig(Configuration, "Icc");
                var builder = new SqlServerDbContextOptionsBuilder(config);
                var result  = new IccBackendContentDbContext(builder.Build());
                return(result);
            });
        }
Beispiel #4
0
 public GetLatestManifestCommand(IUtcDateTimeProvider dateTimeProvider, ExposureContentDbContext dbContext, ManifestBuilder manifestBuilder, IGaenContentConfig gaenContentConfig, IPublishingId publishingId)
 {
     _DateTimeProvider  = dateTimeProvider;
     _DbContext         = dbContext;
     _ManifestBuilder   = manifestBuilder;
     _GaenContentConfig = gaenContentConfig;
     _PublishingId      = publishingId;
 }
Beispiel #5
0
        public CreateContentDatabase(IConfiguration configuration, IUtcDateTimeProvider dateTimeProvider, IContentSigner signer)
        {
            var config  = new StandardEfDbConfig(configuration, "Content");
            var builder = new SqlServerDbContextOptionsBuilder(config);

            _DbContextProvider = new ExposureContentDbContext(builder.Build());
            _DateTimeProvider  = dateTimeProvider;
            _Formatter         = new StandardContentEntityFormatter(new ZippedSignedContentFormatter(signer), new StandardPublishingIdFormatter());
        }
Beispiel #6
0
 public GetLatestManifestCommandWithDbWrite(IUtcDateTimeProvider dateTimeProvider, ExposureContentDbContext dbContext, ManifestBuilder manifestBuilder, IGaenContentConfig gaenContentConfig, IPublishingId publishingId, IJsonSerializer jsonSerializer)
 {
     _DateTimeProvider  = dateTimeProvider;
     _DbContext         = dbContext;
     _ManifestBuilder   = manifestBuilder;
     _GaenContentConfig = gaenContentConfig;
     _PublishingId      = publishingId;
     _JsonSerializer    = jsonSerializer;
 }
 public HttpPostGenerateExposureKeySetsCommand(WorkflowDbContext input, ExposureContentDbContext output, IUtcDateTimeProvider utcDateTimeProvider, IEfDbConfig standardEfDbConfig, IGaenContentConfig gaenContentConfig, IExposureKeySetHeaderInfoConfig hsmExposureKeySetHeaderInfoConfig, IExposureKeySetBatchJobConfig exposureKeySetBatchJobConfig)
 {
     _Input  = input;
     _Output = output;
     _UtcDateTimeProvider = utcDateTimeProvider;
     _StandardEfDbConfig  = standardEfDbConfig;
     _GaenContentConfig   = gaenContentConfig;
     _HsmExposureKeySetHeaderInfoConfig = hsmExposureKeySetHeaderInfoConfig;
     _ExposureKeySetBatchJobConfig      = exposureKeySetBatchJobConfig;
 }
 public App(ILogger <App> logger,
            WorkflowDbContext workflowDbContext,
            ExposureContentDbContext exposureContentDbContext,
            IccBackendContentDbContext iccBackedBackendContentDb)
 {
     _Logger                     = logger;
     _WorkflowDbContext          = workflowDbContext;
     _ExposureContentDbContext   = exposureContentDbContext;
     _IccBackendContentDbContext = iccBackedBackendContentDb;
 }
Beispiel #9
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            ComponentsContainerHelper.RegisterDefaultServices(services);

            services.AddBasicAuthentication();
            services.AddSeriLog(Configuration);
            services.AddControllers();
            services.AddScoped(x =>
            {
                var config  = new StandardEfDbConfig(Configuration, "Content");
                var builder = new SqlServerDbContextOptionsBuilder(config);
                var result  = new ExposureContentDbContext(builder.Build());
                result.BeginTransaction();
                return(result);
            });

            services.AddScoped <HttpPostContentReciever <ManifestEntity>, HttpPostContentReciever <ManifestEntity> >();
            services.AddScoped <HttpPostContentReciever <AppConfigContentEntity>, HttpPostContentReciever <AppConfigContentEntity> >();
            services.AddScoped <HttpPostContentReciever <ResourceBundleContentEntity>, HttpPostContentReciever <ResourceBundleContentEntity> >();
            services.AddScoped <HttpPostContentReciever <RiskCalculationContentEntity>, HttpPostContentReciever <RiskCalculationContentEntity> >();
            services.AddScoped <HttpPostContentReciever <ExposureKeySetContentEntity>, HttpPostContentReciever <ExposureKeySetContentEntity> >();

            services.AddSwaggerGen(o =>
            {
                o.SwaggerDoc("v1", new OpenApiInfo
                {
                    Title   = "Azure CDN Data Receiver API",
                    Version = "v1",
                });

                o.AddSecurityDefinition("basic", new OpenApiSecurityScheme
                {
                    Name        = "Authorization",
                    Type        = SecuritySchemeType.Http,
                    Scheme      = "basic",
                    In          = ParameterLocation.Header,
                    Description = "Basic Authorization header using the Bearer scheme."
                });

                o.AddSecurityRequirement(new OpenApiSecurityRequirement
                {
                    {
                        new OpenApiSecurityScheme
                        {
                            Reference = new OpenApiReference
                            {
                                Type = ReferenceType.SecurityScheme,
                                Id   = "basic"
                            }
                        },
                        new string[] {}
                    }
                });
            });
        }
 public App(ILogger <App> logger,
            WorkflowDbContext workflowDbContext,
            ExposureContentDbContext exposureContentDbContext,
            IccBackendContentDbContext iccBackedBackendContentDb, IConfigurationRoot configuration)
 {
     _Logger                     = logger;
     _WorkflowDbContext          = workflowDbContext;
     _ExposureContentDbContext   = exposureContentDbContext;
     _IccBackendContentDbContext = iccBackedBackendContentDb;
     _Configuration              = configuration;
 }
 public ExposureKeySetBatchJobMk2(/*IExposureKeySetBatchJobConfig jobConfig,*/ IGaenContentConfig gaenContentConfig, IExposureKeySetBuilder builder, WorkflowDbContext workflowDbContext, ExposureContentDbContext contentDbContext, IUtcDateTimeProvider dateTimeProvider, IPublishingId publishingId)
 {
     //_JobConfig = jobConfig;
     _GaenContentConfig = gaenContentConfig;
     _SetBuilder        = builder;
     _WorkflowDbContext = workflowDbContext;
     _ContentDbContext  = contentDbContext;
     _PublishingId      = publishingId;
     _Used   = new List <EksCreateJobInputEntity>(_GaenContentConfig.ExposureKeySetCapacity); //
     _Start  = dateTimeProvider.Now();
     JobName = $"ExposureKeySetsJob_{_Start:u}".Replace(" ", "_").Replace(":", "_");
 }
Beispiel #12
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddScoped(x =>
            {
                var builder = new SqlServerDbContextOptionsBuilder(Environment.GetEnvironmentVariable("ConnectionStrings:Content"));
                var result  = new ExposureContentDbContext(builder.Build());
                result.BeginTransaction();
                return(result);
            });

            services.AddSingleton <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();
            services.AddScoped <ICdnContentConfig, CdnContentConfig>();
            services.AddScoped <CdnContentPurgeCommand, CdnContentPurgeCommand>();
        }
 public HttpPostContentReciever(ExposureContentDbContext dbContext)
 {
     _DbContext = dbContext;
 }
Beispiel #14
0
 public RiskCalculationConfigInsertDbCommand(ExposureContentDbContext contextProvider, IContentEntityFormatter formatter)
 {
     _DbContextProvider = contextProvider;
     _Formatter         = formatter;
 }
 public GetLatestRiskCalculationConfigContentCommand(ExposureContentDbContext dbConfig, IUtcDateTimeProvider dateTimeProvider)
 {
     _DbConfig         = dbConfig;
     _DateTimeProvider = dateTimeProvider;
 }
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSeriLog(Configuration);

            services.AddControllers();
            services.AddBasicAuthentication();

            services.AddScoped <HttpGetManifestBinaryContentCommand, HttpGetManifestBinaryContentCommand>();
            services.AddScoped <DynamicManifestReader, DynamicManifestReader>();
            services.AddScoped <ManifestBuilder, ManifestBuilder>();
            services.AddSingleton <IUtcDateTimeProvider>(new StandardUtcDateTimeProvider());
            services.AddSingleton <IPublishingId>(new StandardPublishingIdFormatter());
            services.AddSingleton <IGaenContentConfig>(new GaenContentConfig(Configuration));
            services.AddSingleton <IContentSigner, CmsSigner>();
            services.AddSingleton <ICertificateProvider, HsmCertificateProvider>();
            services.AddSingleton <IThumbprintConfig>(x => new CertificateProviderConfig(x.GetService <IConfiguration>(), "ExposureKeySets:Signing:NL"));

            services.AddScoped(x =>
            {
                var config  = new StandardEfDbConfig(Configuration, "Content");
                var builder = new SqlServerDbContextOptionsBuilder(config);
                var result  = new ExposureContentDbContext(builder.Build());
                result.BeginTransaction();
                return(result);
            });

            services.AddScoped <GetActiveExposureKeySetsListCommand, GetActiveExposureKeySetsListCommand>();
            services.AddScoped <GetLatestContentCommand <AppConfigContentEntity>, GetLatestContentCommand <AppConfigContentEntity> >();
            services.AddScoped <GetLatestContentCommand <ResourceBundleContentEntity>, GetLatestContentCommand <ResourceBundleContentEntity> >();
            services.AddScoped <GetLatestContentCommand <RiskCalculationContentEntity>, GetLatestContentCommand <RiskCalculationContentEntity> >();

            services.AddScoped <HttpGetBinaryContentCommand <ExposureKeySetContentEntity>, HttpGetBinaryContentCommand <ExposureKeySetContentEntity> >();
            services.AddScoped <HttpGetBinaryContentCommand <AppConfigContentEntity>, HttpGetBinaryContentCommand <AppConfigContentEntity> >();
            services.AddScoped <HttpGetBinaryContentCommand <ResourceBundleContentEntity>, HttpGetBinaryContentCommand <ResourceBundleContentEntity> >();
            services.AddScoped <HttpGetBinaryContentCommand <RiskCalculationContentEntity>, HttpGetBinaryContentCommand <RiskCalculationContentEntity> >();

            services.AddScoped <IReader <ExposureKeySetContentEntity>, SafeBinaryContentDbReader <ExposureKeySetContentEntity> >();
            services.AddScoped <IReader <AppConfigContentEntity>, SafeBinaryContentDbReader <AppConfigContentEntity> >();
            services.AddScoped <IReader <ResourceBundleContentEntity>, SafeBinaryContentDbReader <ResourceBundleContentEntity> >();
            services.AddScoped <IReader <RiskCalculationContentEntity>, SafeBinaryContentDbReader <RiskCalculationContentEntity> >();


            services.AddSwaggerGen(o =>
            {
                o.SwaggerDoc("v1", new OpenApiInfo
                {
                    Title   = Title,
                    Version = "v1",
                });

                o.AddSecurityDefinition("basic", new OpenApiSecurityScheme
                {
                    Name        = "Authorization",
                    Type        = SecuritySchemeType.Http,
                    Scheme      = "basic",
                    In          = ParameterLocation.Header,
                    Description = "Basic Authorization header using the Bearer scheme."
                });

                o.AddSecurityRequirement(new OpenApiSecurityRequirement
                {
                    {
                        new OpenApiSecurityScheme
                        {
                            Reference = new OpenApiReference
                            {
                                Type = ReferenceType.SecurityScheme,
                                Id   = "basic"
                            }
                        },
                        new string[] {}
                    }
                });
            });
        }
 public GetResourceBundleContentCommand(ExposureContentDbContext dbConfig)
 {
     _DbConfig = dbConfig;
 }
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            ComponentsContainerHelper.RegisterDefaultServices(services);

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

            services.AddSeriLog(Configuration);
            services.AddBasicAuthentication();

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

            services.AddScoped(x =>
            {
                var config  = new StandardEfDbConfig(Configuration, "Content");
                var builder = new SqlServerDbContextOptionsBuilder(config);
                var result  = new ExposureContentDbContext(builder.Build());
                return(result);
            });

            services.AddSingleton <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();

            services.AddScoped <HttpPostGenerateExposureKeySetsCommand, HttpPostGenerateExposureKeySetsCommand>();

            services.AddScoped(x =>
                               new ExposureKeySetBatchJobMk2(
                                   x.GetService <IGaenContentConfig>(),
                                   x.GetService <IExposureKeySetBuilder>(),
                                   x.GetService <WorkflowDbContext>(),
                                   x.GetService <ExposureContentDbContext>(),
                                   x.GetService <IUtcDateTimeProvider>(),
                                   x.GetService <IPublishingId>()
                                   ));

            services.AddSingleton <IGaenContentConfig, GaenContentConfig>();
            services.AddScoped <IExposureKeySetBuilder>(x =>
                                                        new ExposureKeySetBuilderV1(
                                                            x.GetService <IExposureKeySetHeaderInfoConfig>(),
                                                            new EcdSaSigner(new HsmCertificateProvider(new CertificateProviderConfig(x.GetService <IConfiguration>(), "ExposureKeySets:Signing:GA"))),
                                                            new CmsSigner(new HsmCertificateProvider(new CertificateProviderConfig(x.GetService <IConfiguration>(), "ExposureKeySets:Signing:NL"))),
                                                            x.GetService <IUtcDateTimeProvider>(), //TODO pass in time thru execute
                                                            new GeneratedProtobufContentFormatter()
                                                            ));
            services.AddScoped <IExposureKeySetHeaderInfoConfig, ExposureKeySetHeaderInfoConfig>();
            services.AddScoped <IPublishingId, StandardPublishingIdFormatter>();

            services.AddSwaggerGen(o =>
            {
                o.SwaggerDoc("v1", new OpenApiInfo {
                    Title = Title, Version = "v1"
                });

                o.AddSecurityDefinition("basic", new OpenApiSecurityScheme
                {
                    Name        = "Authorization",
                    Type        = SecuritySchemeType.Http,
                    Scheme      = "basic",
                    In          = ParameterLocation.Header,
                    Description = "Basic Authorization header using the Bearer scheme."
                });

                o.AddSecurityRequirement(new OpenApiSecurityRequirement
                {
                    {
                        new OpenApiSecurityScheme
                        {
                            Reference = new OpenApiReference
                            {
                                Type = ReferenceType.SecurityScheme,
                                Id   = "basic"
                            }
                        },
                        new string[] {}
                    }
                });
            });
        }
Beispiel #19
0
 public ExposureKeySetExpireCommand(ExposureContentDbContext config, IUtcDateTimeProvider utcDateTimeProvider, IGaenContentConfig gaenContentConfig)
 {
     _DbConfig            = config;
     _UtcDateTimeProvider = utcDateTimeProvider;
     _GaenContentConfig   = gaenContentConfig;
 }
 public SafeBinaryContentDbReader(ExposureContentDbContext dbContextProvider)
 {
     _DbContextProvider = dbContextProvider;
 }
 public ExposureKeySetSafeReadCommand(ExposureContentDbContext dbConfig)
 {
     _DbConfig = dbConfig;
 }
 public ExposureKeySetDbWriter(ExposureContentDbContext dbContext, IPublishingId publishingId)
 {
     _DbContext    = dbContext;
     _PublishingId = publishingId;
 }
 public GetActiveExposureKeySetsListCommand(ExposureContentDbContext dbConfig, IGaenContentConfig gaenContentConfig)
 {
     _DbConfig          = dbConfig;
     _GaenContentConfig = gaenContentConfig;
 }
Beispiel #24
0
 public ResourceBundleInsertDbCommand(ExposureContentDbContext context, IContentEntityFormatter formatter)
 {
     _DbContext = context;
     _Formatter = formatter;
 }
 public CdnContentPurgeCommand(ExposureContentDbContext contentDbContext, IUtcDateTimeProvider dateTimeProvider, ICdnContentConfig config)
 {
     _ContentDbContext = contentDbContext;
     _DateTimeProvider = dateTimeProvider;
     _Config           = config;
 }
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services
            .AddControllers(options => { options.RespectBrowserAcceptHeader = true; })
            //Arming these options only makes them less tolerant of casing on Deserialization and DOES NOT for serialisation to camelCase.
            //.AddNewtonsoftJson(options =>
            //{
            //    options.UseCamelCasing(false); //NB this IS setting camel case - just not for dictionary element names
            //})
            ;

            //Same with this one.
            //services.AddMvc()
            //    .AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase);

            services.AddControllers();

            services.AddSingleton <IUtcDateTimeProvider, StandardUtcDateTimeProvider>();
            services.AddSingleton <IGaenContentConfig, GaenContentConfig>();
            services.AddSingleton <IExposureKeySetBatchJobConfig, ExposureKeySetBatchJobConfig>();
            services.AddScoped <IPublishingId, StandardPublishingIdFormatter>();

            services.AddScoped(x =>
            {
                var config  = new StandardEfDbConfig(Configuration, "Content");
                var builder = new SqlServerDbContextOptionsBuilder(config);
                var result  = new ExposureContentDbContext(builder.Build());
                result.BeginTransaction();
                return(result);
            });

            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(x =>
            {
                var config  = new StandardEfDbConfig(Configuration, "Icc");
                var builder = new SqlServerDbContextOptionsBuilder(config);
                var result  = new IccBackendContentDbContext(builder.Build());
                result.BeginTransaction();
                return(result);
            });

            //Just for the Batch Job
            //services.AddScoped<IEfDbConfig>(x => new StandardEfDbConfig(Configuration, "Job"));
            //services.AddScoped<IExposureKeySetHeaderInfoConfig, ExposureKeySetHeaderInfoConfig>();
            services.AddScoped <IContentSigner, FakeContentSigner>();
            services.AddSingleton <IGeanTekListValidationConfig, StandardGeanCommonWorkflowConfig>();
            services.AddSingleton <ITemporaryExposureKeyValidator, TemporaryExposureKeyValidator>();
            services.AddSingleton <ITemporaryExposureKeyValidatorConfig, TemporaryExposureKeyValidatorConfig>();
            services.AddScoped <IPublishingId, StandardPublishingIdFormatter>();


            services.AddScoped(x =>
                               new ExposureKeySetBatchJobMk2(
                                   x.GetService <IGaenContentConfig>(),
                                   x.GetService <IExposureKeySetBuilder>(),
                                   x.GetService <WorkflowDbContext>(),
                                   x.GetService <ExposureContentDbContext>(),
                                   x.GetService <IUtcDateTimeProvider>(),
                                   x.GetService <IPublishingId>()
                                   ));

            services.AddSingleton <IGaenContentConfig, GaenContentConfig>();
            services.AddScoped <IExposureKeySetBuilder>(x =>
                                                        new ExposureKeySetBuilderV1(
                                                            x.GetService <IExposureKeySetHeaderInfoConfig>(),
                                                            new EcdSaSigner(new ResourceCertificateProvider("FakeECDSA.p12")),
                                                            new CmsSigner(new ResourceCertificateProvider("FakeRSA.p12")),
                                                            x.GetService <IUtcDateTimeProvider>(), //TODO pass in time thru execute
                                                            new GeneratedProtobufContentFormatter()
                                                            ));

            services.AddScoped <IExposureKeySetHeaderInfoConfig, ExposureKeySetHeaderInfoConfig>();
            services.AddSingleton <ISignatureValidator>(new FakeSignatureValidator());

            services.AddScoped(x =>
                               new ExposureKeySetBuilderV1(
                                   x.GetService <ExposureKeySetHeaderInfoConfig>(),
                                   new FakeContentSigner(),
                                   new FakeContentSigner(),
                                   x.GetService <IUtcDateTimeProvider>(),
                                   new GeneratedProtobufContentFormatter()
                                   ));

            services.AddScoped <ManifestBuilder, ManifestBuilder>();
            services.AddScoped <GetActiveExposureKeySetsListCommand, GetActiveExposureKeySetsListCommand>();

            services.AddScoped <ExposureKeySetSafeReadCommand, ExposureKeySetSafeReadCommand>();
            services.AddScoped <SafeGetRiskCalculationConfigDbCommand, SafeGetRiskCalculationConfigDbCommand>();

            services.AddScoped <HttpPostRiskCalculationConfigCommand, HttpPostRiskCalculationConfigCommand>();
            services.AddScoped <RiskCalculationConfigValidator, RiskCalculationConfigValidator>();
            services.AddScoped <RiskCalculationConfigInsertDbCommand, RiskCalculationConfigInsertDbCommand>();

            services.AddScoped <HttpPostResourceBundleCommand, HttpPostResourceBundleCommand>();
            services.AddScoped <ResourceBundleInsertDbCommand, ResourceBundleInsertDbCommand>();
            services.AddScoped <ResourceBundleValidator, ResourceBundleValidator>();

            services.AddScoped <ProvisionDatabasesCommand, ProvisionDatabasesCommand>();
            services.AddScoped <ProvisionDatabasesCommandIcc, ProvisionDatabasesCommandIcc>();
            services.AddScoped <HttpPostGenerateExposureKeySetsCommand, HttpPostGenerateExposureKeySetsCommand>();
            //services.AddScoped<HttpGetCdnContentCommand<ManifestEntity>, HttpGetCdnContentCommand<ManifestEntity>>();

            services.AddScoped <HttpGetSignedCdnContentOnlyCommand <ExposureKeySetContentEntity>, HttpGetSignedCdnContentOnlyCommand <ExposureKeySetContentEntity> >();
            services.AddScoped <HttpGetCdnContentCommand <RiskCalculationContentEntity>, HttpGetCdnContentCommand <RiskCalculationContentEntity> >();
            services.AddScoped <HttpGetCdnContentCommand <ResourceBundleContentEntity>, HttpGetCdnContentCommand <ResourceBundleContentEntity> >();
            services.AddScoped <HttpGetCdnContentCommand <AppConfigContentEntity>, HttpGetCdnContentCommand <AppConfigContentEntity> >();

            services.AddScoped <DynamicManifestReader, DynamicManifestReader>();
            services.AddScoped <IReader <ExposureKeySetContentEntity>, SafeBinaryContentDbReader <ExposureKeySetContentEntity> >();
            services.AddScoped <IReader <ResourceBundleContentEntity>, SafeBinaryContentDbReader <ResourceBundleContentEntity> >();
            services.AddScoped <IReader <RiskCalculationContentEntity>, SafeBinaryContentDbReader <RiskCalculationContentEntity> >();
            services.AddScoped <IReader <AppConfigContentEntity>, SafeBinaryContentDbReader <AppConfigContentEntity> >();
            services.AddScoped <PurgeExpiredSecretsDbCommand, PurgeExpiredSecretsDbCommand>();

            services.AddScoped <HttpPostRegisterSecret, HttpPostRegisterSecret>();
            services.AddScoped <RandomNumberGenerator, RandomNumberGenerator>();
            services.AddScoped <ISecretConfig, StandardSecretConfig>();

            services.AddScoped <ISecretWriter, SecretWriter>();

            services.AddScoped <AuthorisationWriter, AuthorisationWriter>();

            services.AddScoped <HttpPostReleaseTeksCommand, HttpPostReleaseTeksCommand>();
            services.AddScoped <IReleaseTeksValidator, ReleaseTeksValidator>();

            services.AddScoped <ITekWriter, TekWriter>();

            services.AddScoped <HttpPostAppConfigCommand, HttpPostAppConfigCommand>();
            services.AddScoped <AppConfigInsertDbCommand, AppConfigInsertDbCommand>();
            services.AddScoped <AppConfigValidator, AppConfigValidator>();

            services.AddScoped <HttpPostAuthorise, HttpPostAuthorise>();
            services.AddScoped <IAuthorisationWriter, AuthorisationWriter>();

            services.AddScoped <IBasicAuthenticationConfig, BasicAuthenticationConfig>();
            services.AddBasicAuthentication();

            services.AddScoped <GetLatestContentCommand <ResourceBundleContentEntity>, GetLatestContentCommand <ResourceBundleContentEntity> >();
            services.AddScoped <GetLatestContentCommand <RiskCalculationContentEntity>, GetLatestContentCommand <RiskCalculationContentEntity> >();
            services.AddScoped <GetLatestContentCommand <AppConfigContentEntity>, GetLatestContentCommand <AppConfigContentEntity> >();

            services.AddScoped <IContentEntityFormatter, StandardContentEntityFormatter>();
            services.AddScoped <ZippedSignedContentFormatter, ZippedSignedContentFormatter>();

            services.AddScoped <HttpGetManifestBinaryContentCommand, HttpGetManifestBinaryContentCommand>();
            services.AddScoped <DynamicManifestReader, DynamicManifestReader>();
            services.AddScoped <HttpGetManifestSasCommand, HttpGetManifestSasCommand>();

            services.AddSwaggerGen(o =>
            {
                o.SwaggerDoc("v1", new OpenApiInfo
                {
                    Title       = "Dutch Exposure Notification API (inc. dev support)",
                    Version     = "v1",
                    Description = "This specification describes the interface between the Dutch exposure notification app and the backend service.\nTODO: Add signatures to manifest, riskcalculationparameters and appconfig",
                    Contact     = new OpenApiContact
                    {
                        Name = "Ministerie van Volksgezondheid Welzijn en Sport backend repository", //TODO looks wrong?
                        Url  = new Uri("https://github.com/minvws/nl-covid19-notification-app-backend"),
                    },
                    License = new OpenApiLicense
                    {
                        Name = "European Union Public License v. 1.2",
                        //TODO this should be https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
                        Url = new Uri("https://github.com/minvws/nl-covid19-notification-app-backend/blob/master/LICENSE.txt")
                    },
                });
                o.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "NL.Rijksoverheid.ExposureNotification.BackEnd.ServerStandAlone.xml"));
                o.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "NL.Rijksoverheid.ExposureNotification.BackEnd.Components.xml"));


                o.AddSecurityDefinition("basic", new OpenApiSecurityScheme
                {
                    Name        = "Authorization",
                    Type        = SecuritySchemeType.Http,
                    Scheme      = "basic",
                    In          = ParameterLocation.Header,
                    Description = "Basic Authorization header."
                });
                o.AddSecurityRequirement(new OpenApiSecurityRequirement
                {
                    {
                        new OpenApiSecurityScheme
                        {
                            Reference = new OpenApiReference
                            {
                                Type = ReferenceType.SecurityScheme,
                                Id   = "basic"
                            }
                        },
                        new string[] {}
                    }
                });
            });
        }
Beispiel #27
0
 public SafeGetRiskCalculationConfigDbCommand(ExposureContentDbContext contextProvider)
 {
     _DbContextProvider = contextProvider;
 }
 public HttpPostAppConfigCommand(AppConfigInsertDbCommand insertDbCommand, AppConfigValidator validator, ExposureContentDbContext context)
 {
     _InsertDbCommand = insertDbCommand;
     _Validator       = validator;
     _Context         = context;
 }
 public HttpPostRiskCalculationConfigCommand(ExposureContentDbContext contextProvider, RiskCalculationConfigInsertDbCommand writer, RiskCalculationConfigValidator validator)
 {
     _ContextProvider = contextProvider;
     _Writer          = writer;
     _Validator       = validator;
 }
Beispiel #30
0
 public App(ILogger <App> logger, WorkflowDbContext workflowDbContext, ExposureContentDbContext exposureContentDbContext)
 {
     _Logger                   = logger;
     _WorkflowDbContext        = workflowDbContext;
     _ExposureContentDbContext = exposureContentDbContext;
 }