本專案基於 Role-based access control 實作下列模組
- 登入 & 登出
- 註冊 & 驗證 Email
- 忘記密碼 & 重設密碼
- 角色模組
- 功能模組
- 驗證授權狀態 (可限制登入裝置數量)
- 基本資料維護
網址:https://exfast-lexlibrary-rbac-sample.azurewebsites.net/
帳號:admin
密碼:zxcv1234
信箱:admin@exfast.me
部落格:https://blog.exfast.me/2019/01/netcore-lexlibrary-rbac-based-on-role-based-access-control-implementation-verification-module/
找到 Startup.cs
中的 ConfigureServices
方法新增下列程式
services.AddLexLibraryRbac(options =>
{
options.UseSqlServer(_configuration.GetConnectionString("DefaultConnection"));
});
// 請自行實作 ICryptHelper, IEmailSender 介面
services.AddScoped(typeof(ICryptHelper), typeof(CryptHelper));
services.AddScoped(typeof(IEmailSender), typeof(EmailSender));
找到 Startup.cs
中的 Configure
方法新增下列程式
app.UseLexLibraryRbacRoute();
在需要驗證的 Controller 或 Action 上方加入驗證標籤即可
[LexLibraryRbacAuthorize(FunctionIds = "1", RoleIds = "2,1")]