Updated CORS statements Policy

This commit is contained in:
Santhosh S
2023-11-25 23:08:04 -05:00
parent 2ab8f37489
commit 87fa29d9d4
9 changed files with 41 additions and 10 deletions

View File

@ -9,9 +9,12 @@ using System.Reflection;
using System.Text;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddCors(p => p.AddPolicy("DamageAppCorsPolicy", build => {
build.WithOrigins("*").AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin();
}));
// Add services to the container.
var authkey = builder.Configuration.GetValue<string>("JwtSettings:securitykey");
builder.Services.AddAuthentication(item =>
{
item.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
@ -93,7 +96,7 @@ if (app.Environment.IsDevelopment())
employeesProvider.SeedData();
}
}
app.UseCors("DamageAppCorsPolicy");
app.UseAuthentication();
app.UseAuthorization();