LexLibrary.Rbac
本專案基於 Role-based access control 實作下列模組
- 登入 & 登出
- 註冊 & 驗證 Email
- 忘記密碼 & 重設密碼
- 角色模組
- 功能模組
- 驗證授權狀態 (可限制登入裝置數量)
- 基本資料維護
專案演示
- 網址:https://exfast-lexlibrary-rbac-sample.azurewebsites.net/
- 帳號:admin
- 密碼:zxcv1234
- 信箱:[email protected]
- GitHub:https://github.com/shuangrain/LexLibrary.Rbac
加入專案
驗證模組
找到 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")]