Modification du Progam
This commit is contained in:
15
Program.cs
15
Program.cs
@@ -31,6 +31,11 @@ namespace administration
|
||||
options.Cookie.IsEssential = true;
|
||||
});
|
||||
|
||||
builder.Services.AddAuthentication("BasicAuthentication")
|
||||
.AddScheme<AuthenticationSchemeOptions, BasicAuthenticationHandler>("BasicAuthentication", null);
|
||||
|
||||
builder.Services.AddAuthorization();
|
||||
|
||||
// Ajouter les services MVC
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
@@ -65,17 +70,9 @@ namespace administration
|
||||
app.UseCors("AllowFrontend");
|
||||
app.UseSession();
|
||||
|
||||
builder.Services.AddAuthentication("BasicAuthentication")
|
||||
.AddScheme<AuthenticationSchemeOptions, BasicAuthenticationHandler>("BasicAuthentication", null);
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
builder.Services.AddAuthorization(options =>
|
||||
{
|
||||
options.FallbackPolicy = new AuthorizationPolicyBuilder()
|
||||
.RequireAuthenticatedUser()
|
||||
.Build();
|
||||
});
|
||||
// Route par défaut
|
||||
app.MapControllerRoute(
|
||||
name: "default",
|
||||
|
||||
Reference in New Issue
Block a user