[.NETCore][LexLibrary.Rbac] 基於 Role-based access control 實作驗證模組

栏目: ASP.NET · 发布时间: 7年前

内容简介:本專案基於找到找到

LexLibrary.Rbac

本專案基於 Role-based access control 實作下列模組

  1. 登入 & 登出
  2. 註冊 & 驗證 Email
  3. 忘記密碼 & 重設密碼
  4. 角色模組
  5. 功能模組
  6. 驗證授權狀態 (可限制登入裝置數量)
  7. 基本資料維護

專案演示

加入專案

驗證模組

找到 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")]

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Linux Programming Interface

The Linux Programming Interface

Michael Kerrisk / No Starch Press / 2010-11-6 / GBP 79.99

The Linux Programming Interface describes the Linux API (application programming interface)-the system calls, library functions, and other low-level interfaces that are used, directly or indirectly, b......一起来看看 《The Linux Programming Interface》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

在线进制转换器
在线进制转换器

各进制数互转换器

SHA 加密
SHA 加密

SHA 加密工具