-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9cba817
commit e06154a
Showing
2 changed files
with
26 additions
and
10 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
Source/Src/Presentation/CleanArchitecture.WebApi/Infrastracture/Extensions/CorsExtentions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace CleanArchitecture.WebApi.Infrastracture.Extensions; | ||
|
||
public static class CorsExtentions | ||
{ | ||
public static IServiceCollection AddAnyCors(this IServiceCollection services) | ||
{ | ||
return services.AddCors(x => | ||
{ | ||
x.AddPolicy("Any", b => | ||
{ | ||
b.AllowAnyOrigin(); | ||
b.AllowAnyHeader(); | ||
b.AllowAnyMethod(); | ||
}); | ||
}); | ||
} | ||
public static IApplicationBuilder UseAnyCors(this IApplicationBuilder app) | ||
{ | ||
return app.UseCors("Any"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters