Esempio n. 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory,
                              SportContext sportContext)
        {
            loggerFactory.AddConsole();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            sportContext.EnsureSeedDataForContext();

            AutoMapper.Mapper.Initialize(cfg => {
                cfg.CreateMap <Entities.Activity, Model.Activity>();
                cfg.CreateMap <Model.ActivityForCreationAndUpdate, Entities.Activity>();
                cfg.CreateMap <Model.ClientActivityForCreation, Entities.ClientActivity>();
                cfg.CreateMap <Entities.ClientActivity, Model.ClientActivity>();
            });

            app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
            {
                /*Authority = "http://localhost:5001",
                 *
                 * ApiName = "postman_api",
                 * AllowedScopes = {"postman_api"},
                 *
                 * RequireHttpsMetadata = false*/
                Authority            = "https://localhost:44382/",
                RequireHttpsMetadata = true,

                ApiName = "sportapi"
            });

            app.UseMvc();
        }