Skip to content

Commit

Permalink
Add initial cors config
Browse files Browse the repository at this point in the history
  • Loading branch information
kjetilhau committed Oct 1, 2024
1 parent 00e8f7f commit 642e2e7
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
builder.Services.Configure<ApplicationInsightsOptions>(builder.Configuration.GetSection("ApplicationInsights"));
builder.Services.Configure<CacheOptions>(builder.Configuration.GetSection("Cache"));

// CORS setup
builder.Services.AddCors(options =>
options.AddDefaultPolicy(corsPolicyBuilder =>
corsPolicyBuilder.AllowAnyOrigin()
.AllowAnyHeader()
.AllowAnyMethod()));

// Add bearer auth
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddMicrosoftIdentityWebApi(builder.Configuration)
Expand Down Expand Up @@ -100,6 +107,8 @@

app.UseRouting();

app.UseCors();

app.UseAuthorization();

app.UseResponseCompression();
Expand Down

0 comments on commit 642e2e7

Please sign in to comment.