Exemple #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)
        {
            if (env.IsDevelopment())
            {
                app.UseExceptionHandler("/E");
                app.UseDatabaseErrorPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/E");
            }

            app.UseMiddleware <NoTenantMiddleware>();

            app.UseStaticFiles();

            //Obsolete in .NET Core 2.0
            //app.UseIdentity();

            app.UseAuthentication();

            if (RequireHttps)
            {
                app.UseCookiePolicy(new CookiePolicyOptions {
                    Secure = CookieSecurePolicy.Always
                });
            }

            app.UseSession();

            UserEnricher.Initialize(app.ApplicationServices);

            //Needs to be after app.Authentication()
            app.UseMiddleware <TokenAuthenticationMiddleware>();
            app.UseCorrelationId();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            // Enable middleware to serve generated Swagger as a JSON endpoint.
            app.UseSwagger();

            // Enable middleware to serve swagger-ui (HTML, JS, CSS etc.), specifying the Swagger JSON endpoint.
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Traffk");
            });
        }
Exemple #2
0
 public UserController(IDistributedCache cache, IUserAppService userAppService, IUrlHelper urlHelper)
 {
     _cache          = cache;
     _userAppService = userAppService;
     _userEnricher   = new UserEnricher(urlHelper);
 }