Esempio n. 1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();

            services.AddIdentityServer()
            .AddSigningCredential(InMemoryConfiguration.GetX509Certificate2())
            .AddInMemoryIdentityResources(InMemoryConfiguration.GetIdentityResources)
            .AddInMemoryApiResources(InMemoryConfiguration.GetApiResources)
            .AddInMemoryClients(InMemoryConfiguration.GetApiClients)
            .AddTestUsers(InMemoryConfiguration.GetApiUsers);


            services.AddCors(o => o.AddPolicy("CorsPolicy", b =>
            {
                b.WithOrigins(Environment.GetEnvironmentVariable("CLIENT_URL").Split(","))
                .AllowAnyMethod()
                .AllowAnyHeader();
            }));
            services.AddMvcCore(options => options.EnableEndpointRouting = false).SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Version_3_0);
        }