|
@@ -80,7 +80,7 @@ builder.Services.AddControllers(options =>
|
|
|
{
|
|
|
|
|
|
options.Filters.Add(new InputValidationActionFilter());
|
|
|
-
|
|
|
+
|
|
|
options.Filters.Add(typeof(InputValidationActionFilter));
|
|
|
});
|
|
|
|
|
@@ -110,7 +110,9 @@ builder.Services.AddSignalR(options =>
|
|
|
{
|
|
|
options.EnableDetailedErrors = true;
|
|
|
});
|
|
|
-
|
|
|
+builder.Services.AddCors(options => {
|
|
|
+ options.AddPolicy("CORSPolicy", builder => builder.AllowAnyMethod().AllowAnyHeader().AllowCredentials().SetIsOriginAllowed((hosts) => true));
|
|
|
+});
|
|
|
builder.Services.AddSwaggerGen(swagger =>
|
|
|
{
|
|
|
|
|
@@ -119,7 +121,7 @@ builder.Services.AddSwaggerGen(swagger =>
|
|
|
|
|
|
swagger.SchemaFilter<EnumSchemaFilter>();
|
|
|
|
|
|
-
|
|
|
+
|
|
|
swagger.SwaggerDoc("v1", new OpenApiInfo
|
|
|
{
|
|
|
Version = "v1",
|
|
@@ -131,7 +133,7 @@ builder.Services.AddSwaggerGen(swagger =>
|
|
|
d => (d.ActionDescriptor as ControllerActionDescriptor)?.ControllerName + (d.ActionDescriptor as ControllerActionDescriptor)?.ActionName
|
|
|
);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
swagger.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme()
|
|
|
{
|
|
|
Name = "Authorization",
|
|
@@ -173,13 +175,13 @@ app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "MTWorkHR.AP
|
|
|
|
|
|
app.UseRouting();
|
|
|
|
|
|
-app.UseCors(x => x
|
|
|
- .WithOrigins("https://api.mtwork.com", "https://mtworkhrclient.azurewebsites.net", "http://localhost:4200", "https://www.mtwork.com")
|
|
|
- .AllowAnyMethod()
|
|
|
- .AllowAnyHeader()
|
|
|
- .AllowCredentials()
|
|
|
-);
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+app.UseCors("CORSPolicy");
|
|
|
|
|
|
|
|
|
|