Beispiel #1
0
        public IActionResult Configure(ComplianceSettings model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            System.IO.File.WriteAllText("compliancesettings.runtime.json", JsonConvert.SerializeObject(new { ComplianceSettings = model }));

            _applicationLifetime.StopApplication();
            return(View(nameof(Index)));
        }
Beispiel #2
0
        public Startup(IHostingEnvironment env)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(env.ContentRootPath)
                          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                          .AddJsonFile("compliancesettings.json")
                          .AddJsonFile("compliancesettings.runtime.json", optional: true);

            Configuration    = builder.Build();
            _complianceLevel = Configuration
                               .GetSection(nameof(ComplianceSettings))
                               .Get <ComplianceSettings>();
            ConfigurableCountermeasures.Use(_complianceLevel);
        }
Beispiel #3
0
 public ConfigController(ComplianceSettings settings, IApplicationLifetime applicationLifetime)
 {
     _applicationLifetime = applicationLifetime;
     _settings            = settings;
 }
Beispiel #4
0
 public RiskController(ComplianceSettings settings, IViewRenderService viewRenderService)
 {
     _settings          = settings ?? throw new ArgumentNullException(nameof(settings));
     _viewRenderService = viewRenderService ?? throw new ArgumentNullException(nameof(viewRenderService));
 }