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,7 +9,9 @@ using System.Reflection;
using Microsoft.OpenApi.Models;
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 =>
@ -93,6 +95,7 @@ if (app.Environment.IsDevelopment())
}
}
app.UseCors("DamageAppCorsPolicy");
app.UseAuthentication();
app.UseAuthorization();