|
|
|
@ -16,6 +16,8 @@ namespace EPAServeur |
|
|
|
|
{ |
|
|
|
|
public class Startup |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
readonly string AllowCrossClientEPA = "_AllowsCrossOriginClientEPA"; |
|
|
|
|
public Startup(IConfiguration configuration) |
|
|
|
|
{ |
|
|
|
|
Configuration = configuration; |
|
|
|
@ -26,6 +28,15 @@ namespace EPAServeur |
|
|
|
|
// This method gets called by the runtime. Use this method to add services to the container. |
|
|
|
|
public void ConfigureServices(IServiceCollection services) |
|
|
|
|
{ |
|
|
|
|
services.AddCors(options => |
|
|
|
|
{ |
|
|
|
|
options.AddPolicy(name: AllowCrossClientEPA, |
|
|
|
|
builder => |
|
|
|
|
{ |
|
|
|
|
builder.WithOrigins("http://localhost:4200").AllowAnyHeader().AllowAnyMethod(); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
services.AddControllers(); |
|
|
|
|
services.AddAuthentication(BearerAuthenticationHandler.SchemeName) |
|
|
|
|
.AddScheme<AuthenticationSchemeOptions, BearerAuthenticationHandler>(BearerAuthenticationHandler.SchemeName, null); |
|
|
|
@ -70,6 +81,8 @@ namespace EPAServeur |
|
|
|
|
|
|
|
|
|
app.UseRouting(); |
|
|
|
|
|
|
|
|
|
app.UseCors(AllowCrossClientEPA); |
|
|
|
|
|
|
|
|
|
app.UseAuthorization(); |
|
|
|
|
|
|
|
|
|
app.UseEndpoints(endpoints => |
|
|
|
|