Example #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)
        {
            var authorityUrl = Configuration["IdentityServer:AuthorityUrl"];

            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseCors(builder => builder.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin());

            app.UseIdentityServer();

            app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
            {
                Authority            = authorityUrl,
                RequireHttpsMetadata = false,
                ApiName = "api"
            });

            app.UseMvc();

            app.UseSwagger((httpRequest, swaggerDoc) => { swaggerDoc.Host = httpRequest.Host.Value; });

            app.UseSwaggerUi();

            if (_environment.IsEnvironment("Development") || _environment.IsEnvironment("Travis"))
            {
                // if uncommenting this the application is clearing and seeding the database on every start.
                // if you want to work with peristent data for longer time keep this comment

                // app.SeedData();
            }

            IdentityServerStorageSeed.InitializeIdentitySrvDatabase(app);
        }
Example #2
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)
        {
            app.UseIdentityServer();

            app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
            {
                Authority            = "http://localhost:8001",
                RequireHttpsMetadata = false,
                ApiName = "api"
            });

            app.UseMvc();

            if (_environment.IsEnvironment("Development") || _environment.IsEnvironment("Travis"))
            {
                app.SeedData();
            }

            IdentityServerStorageSeed.InitializeIdentitySrvDatabase(app);
        }