public void ConfigureServices(IServiceCollection services) { var apiExtensionsConfig = new ApiExtensionsConfig(AppSettings); services.AddMvcCore() .AddAuthorization(); services.AddSingleton(AppSettings); services.AddHttpContextAccessor(); services.AddMemoryCache(); services.AddScoped <ApiUser>(); services.AddScoped <TenantManagementApi <TenantDto> >((collection) => { return(new TenantManagementApi <TenantDto>(new Is4ManagementRestClient(apiExtensionsConfig), apiExtensionsConfig)); }); services.AddHealthChecks(); services.AddCors(options => { // this defines a CORS policy called "default" options.AddPolicy("default", policy => { policy.AllowAnyHeader() .AllowAnyMethod() .AllowAnyOrigin() .Build(); }); }); services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => { options.Authority = AppSettings.Is4Host; options.Audience = AppSettings.ApiAuthenticationAudience; }); }