Adding CORS policy to all micro-services

This commit is contained in:
Reginald Cherenfant Jasmin
2023-11-10 13:07:50 -05:00
parent d0650c36f3
commit 17df019d55
8 changed files with 35 additions and 8 deletions

View File

@ -29,6 +29,11 @@ builder.Services.AddAuthentication(item =>
};
});
builder.Services.AddCors(p => p.AddPolicy("DamageAppCorsPolicy", build => {
build.WithOrigins("*").AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin();
}));
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddScoped<ISurveyProvider, SurveysProvider>();
@ -62,6 +67,7 @@ if (app.Environment.IsDevelopment())
}
}
app.UseCors("DamageAppCorsPolicy");
app.UseAuthentication();
app.UseAuthorization();