如何根据用户角色创建登录

问题描述 投票:0回答:1

我创建了一个没有身份验证的asp.net核心mvc项目。如何创建角色并将其分配给用户,以便我可以使用控制器中的角色来过滤访问?

asp.net asp.net-mvc ef-core-2.0
1个回答
0
投票

您可以在这种情况下使用ASP.NET Identity(如果项目没有身份验证,则手动设置数据库)

参考https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity?view=aspnetcore-2.2&tabs=visual-studio

https://github.com/pacal/Identity_SQL上的ASP.NET Identity DB脚本

© www.soinside.com 2019 - 2024. All rights reserved.