예제 #1
0
        public void Configure
            (Microsoft.AspNetCore.Builder.IApplicationBuilder app,
            Microsoft.AspNetCore.Hosting.IWebHostEnvironment env)
        {
            app.UseHttpsRedirection();

            app.UseRouting();

            // Global cors policy
            app.UseCors(current => current
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader());

            // Custom JWT auth middleware
            app.UseMiddleware <Infrastructure.Middlewares.JwtMiddleware>();

            // Swagger middleware
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "v1");
            });

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
예제 #2
0
        public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseJimu(this Microsoft.AspNetCore.Builder.IApplicationBuilder app, IApplication host)
        {
            Console.WriteLine();
            app.UseMiddleware <JimuHttpStatusCodeExceptionMiddleware>();
            //app.UseCors(builder =>
            //{
            //    builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod();
            //});

            var httpContextAccessor = app.ApplicationServices.GetRequiredService <IHttpContextAccessor>();

            JimuHttpContext.Configure(httpContextAccessor);
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller}/{action}");
                routes.MapRoute(
                    name: "defaultApi",
                    template: "api/{controller}/{action}");
                routes.MapRoute(
                    "swagger",
                    "swagger/{*path}"
                    );
                routes.MapRoute(
                    "JimuPath",
                    "{*path:regex(^(?!swagger))}",
                    new { controller = "JimuServices", action = "JimuPath" });
            });

            JimuClient.Host = host;
            return(app);
        }
        public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseSecurityHeadersMiddleware(
            this Microsoft.AspNetCore.Builder.IApplicationBuilder app, SecurityHeadersBuilder builder)
        {
            SecurityHeadersPolicy policy = builder.Build();

            return(app.UseMiddleware <SecurityHeadersMiddleware>(policy));
        }
예제 #4
0
 /// <summary>
 /// Added the middlware that creates and disposes a <see cref="IRenderEngine"/> for each request
 /// </summary>
 /// <param name="app">The application.</param>
 public static void UseJsEngine(
     this AppBuilder app
     #if !DOTNETCORE
     , IRenderEngineFactory renderEngineFactory
     #endif
     )
 {
     #if !DOTNETCORE
     app.Use <RenderEngineMiddleware>(renderEngineFactory);
     #else
     app.UseMiddleware <RenderEngineMiddleware>();
     #endif
 }
예제 #5
0
 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(Microsoft.AspNetCore.Builder.IApplicationBuilder app)
 {
     app.UseMvc();
     app.UseMiddleware <HttpMiddleware>(_middlewares, _serviceEntryContainer, _logger);
 }
예제 #6
0
 /// <summary>
 /// Add Coddee <see cref="DynamicApi"/> middleware
 /// </summary>
 public static IApplicationBuilder UseCoddeeDynamicApi(this IApplicationBuilder appBuilder)
 {
     appBuilder.UseMiddleware <DynamicApi>();
     return(appBuilder);
 }
 /// <summary>
 /// Added the middlware that creates and disposes a <see cref="IRenderEngine"/> for each request
 /// </summary>
 /// <param name="app">The application.</param>
 public static void UseJsEngine(this AppBuilder app)
 {
     app.UseMiddleware <RenderEngineMiddleware>();
 }
예제 #8
0
 public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseErrorHandlingMiddleware(
     this Microsoft.AspNetCore.Builder.IApplicationBuilder app)
 {
     app.UseMiddleware <ErrorHandlingMiddleware>();
     return(app);
 } // End Function UseErrorHandlingMiddleware
예제 #9
0
 public void UseMiddleware(Microsoft.AspNetCore.Builder.IApplicationBuilder app)
 {
     app.UseMiddleware <RaftMiddleware>(this);
 }
 UseExceptionHandlingMiddleware(this Microsoft.AspNetCore.Builder.IApplicationBuilder builder)
 {
     // UseMiddleware -> Extension Method -> using Microsoft.AspNetCore.Builder;
     return(builder.UseMiddleware
            <LoggingMicroservice.Api.Infrastructure.Middlewares.ExceptionHandlingMiddleware>());
 }