diff --git a/EnotaryoPH/EnotaryoPH.Web/Program.cs b/EnotaryoPH/EnotaryoPH.Web/Program.cs index 4cfc6e0..9d4cd94 100644 --- a/EnotaryoPH/EnotaryoPH.Web/Program.cs +++ b/EnotaryoPH/EnotaryoPH.Web/Program.cs @@ -14,7 +14,8 @@ namespace EnotaryoPH.Web builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, options => options.LoginPath = new Microsoft.AspNetCore.Http.PathString("/Login")); - builder.Services.AddRazorPages(); + builder.Services.AddAuthorization(options => options.AddPolicy("PrincipalPolicy", policy => policy.RequireRole("Principal"))); + builder.Services.AddRazorPages(options => options.Conventions.AuthorizeFolder("/Principal", "PrincipalPolicy")); builder.Services.AddDbContext(); builder.Services.AddTransient(); builder.Services.AddHttpContextAccessor();