예제 #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostEnvironment env, ConfigurationsService configurations)
        {
            // Use static files
            app.UseStaticFiles(new StaticFileOptions {
                OnPrepareResponse = ctx => { ctx.Context.Response.Headers.Append("Cache-Control", "public, max-age=604800"); }
            });

            // Uses routes
            app.UseRouting();

            // Cors
            app.UseCors("Travian");

            // Uses authentication
            app.UseAuthentication();

            // Use authorization
            app.UseAuthorization();

            // Uses session
            app.UseSession();

            // Session handler
            app.UseMiddleware <SessionHandler>();



            if (_isProduction)
            {
                // Show errors in page
                app.UseHsts();

                // Error Handling
                app.UseStatusCodePages();

                // Redirect options (www and https)
                var rewriteOptions = new RewriteOptions();
                if (configurations.RedirectWww)
                {
                    rewriteOptions.AddRedirectToWwwPermanent();
                }

                if (configurations.RedirectHttps)
                {
                    app.UseHttpsRedirection();
                    rewriteOptions.AddRedirectToHttpsPermanent();
                }

                app.UseRewriter(rewriteOptions);
            }
            else
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseMiddleware <RedirectHandler>();

            // Map routes
            app.UseEndpoints(endpoints => endpoints.MapControllers());
        }
예제 #2
0
 // GET: AdminTH/TaxiHailNetwork
 public TaxiHailNetworkController(ICacheClient cache,
                                  IServerSettings serverSettings,
                                  ITaxiHailNetworkServiceClient taxiHailNetworkService,
                                  ConfigurationsService configurationsService,
                                  IFeesDao feesDao,
                                  ICommandBus commandBus)
     : base(cache, serverSettings)
 {
     _serverSettings         = serverSettings;
     _taxiHailNetworkService = taxiHailNetworkService;
     _configurationsService  = configurationsService;
     _feesDao    = feesDao;
     _commandBus = commandBus;
 }