// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddCors(); services.AddMvcCore() .AddAuthorization() .AddJsonFormatters(); OidcConfiguration oidcConfiguration = IdentityServerConfiguration.GetOidcConfiguration(); services.AddAuthentication(Constant.AuthenticationHeaderPrefix) .AddIdentityServerAuthentication(opt => { opt.Authority = "http://localhost:5000"; opt.RequireHttpsMetadata = false; opt.RoleClaimType = "role"; opt.ApiName = "breadshop"; }); DbContextOptions <BreadShopDatabaseContext> options = new DbContextOptionsBuilder <BreadShopDatabaseContext>() .UseInMemoryDatabase(databaseName: "BreadShopDatabase") .Options; services.AddSingleton(options).AddScoped <BreadShopDatabaseContext>(); services.AddScoped <IProductRepository, ProductRepository>(); services.AddScoped <IProductApplicationService, ProductApplicationService>(); services.AddScoped <IStockRepository, StockRepository>(); services.AddScoped <IStockApplicationService, StockApplicationService>(); }