Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shesha-core/src/Shesha.Web.Host/Startup/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public void Configure(IApplicationBuilder app, IBackgroundJobClient backgroundJo
});

app.UseMiddleware<GraphQLMiddleware>();
if (_hostEnvironment.IsDevelopment())
if (!_hostEnvironment.IsProduction())
{
app.UseGraphQLPlayground(); //to explorer API navigate https://*DOMAIN*/ui/playground
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
Expand All @@ -10,7 +9,6 @@ namespace Boxfusion.SheshaFunctionalTests.Web.Host.Controllers
[AllowAnonymous]
public class HomeController : SheshaControllerBase
{

private readonly ISecuritySettings _securitySettings;

public HomeController(ISecuritySettings securitySettings)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
using Swashbuckle.AspNetCore.SwaggerGen;
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.Extensions.Hosting;
using Shesha.Specifications;

namespace Boxfusion.SheshaFunctionalTests.Web.Host.Startup
Expand Down Expand Up @@ -156,11 +158,21 @@ public void Configure(IApplicationBuilder app, IBackgroundJobClient backgroundJo
options.UseAbpRequestLocalization = false;
});

// Security headers
app.UseSecurityHeaders();

// global cors policy
var corsOrigins = _appConfiguration["App:CorsOrigins"]?
.Split(",", StringSplitOptions.RemoveEmptyEntries)
.Select(o => o.Trim().TrimEnd('/'))
.Where(o => !string.IsNullOrEmpty(o))
.ToArray() ?? Array.Empty<string>();
app.UseCors(x => x
.AllowAnyMethod()
.AllowAnyHeader()
.SetIsOriginAllowed(origin => true) // allow any origin
.AllowCredentials()); // allow credentials​
.WithOrigins(corsOrigins)
.AllowCredentials());

app.UseStaticFiles();
app.UseAuthentication();
app.UseAbpRequestLocalization();
Expand Down Expand Up @@ -198,15 +210,16 @@ public void Configure(IApplicationBuilder app, IBackgroundJobClient backgroundJo
.GetManifestResourceStream("Boxfusion.SheshaFunctionalTests.Web.Host.wwwroot.swagger.ui.index.html");
}); // URL: /swagger​



app.UseHangfireDashboard("/hangfire",
new DashboardOptions
{
Authorization = new[] { new HangfireAuthorizationFilter() }
});
app.UseMiddleware<GraphQLMiddleware>();
app.UseGraphQLPlayground(); //to explorer API navigate https://*DOMAIN*/ui/playground
if (!_hostEnvironment.IsProduction())
{
app.UseGraphQLPlayground(); //to explorer API navigate https://*DOMAIN*/ui/playground
}
}

private void AddApiVersioning(IServiceCollection services)
Expand Down