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