[.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")]

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

查看所有标签

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

Single Page Web Applications

Single Page Web Applications

Michael Mikowski、Josh Powell / Manning Publications / 2013-9-30 / USD 44.99

Code for most web sites mostly runs on the server. When a user clicks on a link, the site reacts slowly because the browser sends information to the server and the server sends it back again before di......一起来看看 《Single Page Web Applications》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

html转js在线工具
html转js在线工具

html转js在线工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具