在MVC中配置鉴权

builder.Services.AddAuthentication(option =>
{
    option.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
}).AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, option =>
{
    option.LoginPath = "/Login/Index";//没登录跳到登录页
    option.AccessDeniedPath = "/Login/NoAuthority"; //登录了没权限
});

 

posted @ 2024-08-08 08:44  龙卷风吹毁停车场  阅读(9)  评论(0)    收藏  举报