Skip to content

Commit

Permalink
code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
damienbod committed Oct 26, 2024
1 parent fb97693 commit a31a7f5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
5 changes: 2 additions & 3 deletions BlazorAuth0Bff/Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

var services = builder.Services;
var configuration = builder.Configuration;
var env = builder.Environment;

services.AddAntiforgery(options =>
{
Expand Down Expand Up @@ -102,7 +101,7 @@

var app = builder.Build();

if (env.IsDevelopment())
if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseWebAssemblyDebugging();
Expand All @@ -115,7 +114,7 @@
var idp = $"https://{configuration["Auth0:Domain"]}";
app.UseSecurityHeaders(
SecurityHeadersDefinitions
.GetHeaderPolicyCollection(env.IsDevelopment(), idp));
.GetHeaderPolicyCollection(app.Environment.IsDevelopment(), idp));

app.UseHttpsRedirection();
app.UseBlazorFrameworkFiles();
Expand Down
3 changes: 1 addition & 2 deletions MyApi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

var services = builder.Services;
var configuration = builder.Configuration;
var env = builder.Environment;

// only needed for browser clients
//services.AddCors(options =>
Expand Down Expand Up @@ -122,7 +121,7 @@
JsonWebTokenHandler.DefaultInboundClaimTypeMap.Clear();

app.UseSecurityHeaders(
SecurityHeadersDefinitions.GetHeaderPolicyCollection(env.IsDevelopment()));
SecurityHeadersDefinitions.GetHeaderPolicyCollection(app.Environment.IsDevelopment()));

app.UseSwagger();
app.UseSwaggerUI(c =>
Expand Down
5 changes: 2 additions & 3 deletions RazorMicrosoftEntraID/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

var services = builder.Services;
var configuration = builder.Configuration;
var env = builder.Environment;

services.AddTransient<MyApiOneService>();
services.AddHttpClient();
Expand All @@ -36,7 +35,7 @@

var app = builder.Build();

if (env.IsDevelopment())
if (app.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
Expand All @@ -46,7 +45,7 @@
}

app.UseSecurityHeaders(
SecurityHeadersDefinitions.GetHeaderPolicyCollection(env.IsDevelopment()));
SecurityHeadersDefinitions.GetHeaderPolicyCollection(app.Environment.IsDevelopment()));

app.UseHttpsRedirection();
app.UseStaticFiles();
Expand Down

0 comments on commit a31a7f5

Please sign in to comment.