diff --git a/DamageAssesmentApi/DamageAssesment.Api.Answers/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Answers/Program.cs index 77e7544..18759d5 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Answers/Program.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Answers/Program.cs @@ -9,6 +9,10 @@ using System.Reflection; using System.Text; var builder = WebApplication.CreateBuilder(args); +builder.Services.AddCors(p => p.AddPolicy("DamageAppCorsPolicy", build => { + build.WithOrigins("*").AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin(); +})); + var authkey = builder.Configuration.GetValue("JwtSettings:securitykey"); builder.Services.AddAuthentication(item => { @@ -85,6 +89,7 @@ if (app.Environment.IsDevelopment()) app.UseSwagger(); app.UseSwaggerUI(); } +app.UseCors("DamageAppCorsPolicy"); app.UseAuthentication(); app.UseAuthorization(); diff --git a/DamageAssesmentApi/DamageAssesment.Api.Attachments/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Attachments/Program.cs index 62cf0cb..5d73ec1 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Attachments/Program.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Attachments/Program.cs @@ -11,7 +11,11 @@ using System.Reflection; using System.Text; var builder = WebApplication.CreateBuilder(args); +builder.Services.AddCors(p => p.AddPolicy("DamageAppCorsPolicy", build => { + build.WithOrigins("*").AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin(); +})); var authkey = builder.Configuration.GetValue("JwtSettings:securitykey"); + builder.Services.AddAuthentication(item => { item.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; @@ -94,7 +98,7 @@ if (app.Environment.IsDevelopment()) app.UseSwagger(); app.UseSwaggerUI(); } - +app.UseCors("DamageAppCorsPolicy"); app.UseAuthentication(); app.UseAuthorization(); app.UseHttpsRedirection(); diff --git a/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Program.cs index cdd5a72..ff3a258 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Program.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Program.cs @@ -9,9 +9,12 @@ using System.Text; 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("JwtSettings:securitykey"); + builder.Services.AddAuthentication(item => { item.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; @@ -85,7 +88,7 @@ if (app.Environment.IsDevelopment()) app.UseSwagger(); app.UseSwaggerUI(); } - +app.UseCors("DamageAppCorsPolicy"); app.UseAuthentication(); app.UseAuthorization(); diff --git a/DamageAssesmentApi/DamageAssesment.Api.Employees/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Employees/Program.cs index 0702b58..071cc80 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Employees/Program.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Employees/Program.cs @@ -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("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(); diff --git a/DamageAssesmentApi/DamageAssesment.Api.Locations/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Locations/Program.cs index cf4c0d2..ca9bb42 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Locations/Program.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Locations/Program.cs @@ -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("JwtSettings:securitykey"); + builder.Services.AddAuthentication(item => { item.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; @@ -96,7 +99,7 @@ if (app.Environment.IsDevelopment()) regionProvider.SeedData(); } } - +app.UseCors("DamageAppCorsPolicy"); app.UseAuthentication(); app.UseAuthorization(); diff --git a/DamageAssesmentApi/DamageAssesment.Api.Questions/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Questions/Program.cs index dfd6a07..9f704b8 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Questions/Program.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Questions/Program.cs @@ -9,6 +9,9 @@ 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("JwtSettings:securitykey"); builder.Services.AddAuthentication(item => @@ -93,6 +96,7 @@ if (app.Environment.IsDevelopment()) questionProvider.SeedData(); } } +app.UseCors("DamageAppCorsPolicy"); app.UseAuthentication(); app.UseAuthorization(); diff --git a/DamageAssesmentApi/DamageAssesment.Api.Responses/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Responses/Program.cs index 4a96c9b..7f3473b 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Responses/Program.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Responses/Program.cs @@ -16,6 +16,9 @@ const int intervalToRetry = 2; //2 seconds const int maxRetryForCircuitBraker = 5; const int intervalForCircuitBraker = 5; //5 seconds +builder.Services.AddCors(p => p.AddPolicy("DamageAppCorsPolicy", build => { + build.WithOrigins("*").AllowAnyMethod().AllowAnyHeader().AllowAnyOrigin(); +})); // Add services to the container. var authkey = builder.Configuration.GetValue("JwtSettings:securitykey"); @@ -106,7 +109,7 @@ if (app.Environment.IsDevelopment()) app.UseSwagger(); app.UseSwaggerUI(); } - +app.UseCors("DamageAppCorsPolicy"); app.UseAuthentication(); app.UseAuthorization(); diff --git a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Program.cs index 6d79d25..a1cdac7 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Program.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Program.cs @@ -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("JwtSettings:securitykey"); builder.Services.AddAuthentication(item => @@ -93,6 +95,7 @@ if (app.Environment.IsDevelopment()) } } +app.UseCors("DamageAppCorsPolicy"); app.UseAuthentication(); app.UseAuthorization(); diff --git a/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/Program.cs index 567e613..c628445 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/Program.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/Program.cs @@ -17,7 +17,9 @@ const int maxRetryForCircuitBraker = 5; const int intervalForCircuitBraker = 5; //5 seconds 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("JwtSettings:securitykey"); @@ -139,6 +141,7 @@ if (app.Environment.IsDevelopment()) } } +app.UseCors("DamageAppCorsPolicy"); app.UseAuthentication(); app.UseAuthorization();