41 lines
1.1 KiB
C#
Executable File
41 lines
1.1 KiB
C#
Executable File
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Auth.API.Config;
|
|
|
|
public static class Cors
|
|
{
|
|
public static IServiceCollection AddCustomCors(this IServiceCollection services)
|
|
{
|
|
services.AddCors(options =>
|
|
{
|
|
options.AddDefaultPolicy(builder =>
|
|
{
|
|
builder
|
|
.WithOrigins("http://localhost:5211", "http://localhost:5055")
|
|
.AllowAnyHeader()
|
|
.AllowAnyMethod().AllowCredentials()
|
|
.WithExposedHeaders("*");
|
|
;
|
|
});
|
|
|
|
options.AddPolicy(
|
|
"default",
|
|
builder =>
|
|
{
|
|
builder
|
|
.WithOrigins("http://localhost:5211" , "http://localhost:5055")
|
|
.AllowAnyHeader()
|
|
.AllowAnyMethod().AllowCredentials()
|
|
.WithExposedHeaders("*");
|
|
;
|
|
}
|
|
);
|
|
});
|
|
|
|
return services;
|
|
}
|
|
}
|