Shiro登入及許可權管理

2021-10-06 15:40:09 字數 757 閱讀 3505

github位址

使用shiro+springboot+mybatis實現簡單的登入和許可權管理,使用自定義許可權註解實現許可權管理。

資料庫表user

欄位名示例id1

username

1password

1資料庫表auth

欄位名示例id1

username

1role

user

permission

user:hi

快速上手 其他

1.使用者呼叫login介面登入,get請求傳過去明文username和password

2.未登入使用者不可訪問介面,會被跳轉到login.html頁面

3.已登入使用者校驗是否擁有訪問介面的許可權,如果有對應許可權(或關係)就可以訪問對應的介面

4.自定義的許可權註解,多個資源用逗號連線即可,此處邏輯預留擴充套件性,可以自己拓展@permissioncheck(「user:hi,demo:good,demo:test」)

5.過濾器globalfilter->(prehandle->posthandle->aftercompletion)均可自定義處理邏輯,擴充套件功能

error list

1.如果某些bean提前被例項化,它就很有可能不能被所有的`beanpostprocessor處理到了因此會報 * is not eligible for getting processed by all beanpostprocessors可以加上@lazy註解解決,目前不知道有沒有更好的解決方法

Shiro許可權管理

shiro許可權管理 一.許可權管理的四張核心的表關係 使用者表使用者 角色 關係表 角色表角色 許可權 關係表 許可權表角色 選單 關係表 選單表二.許可權的控制項 粗粒度配置檔案配置 細粒度通過註解實現 三.了解認證和授權的流程 前端發起登入請求 訪問shiro的subject subject....

Shiro許可權管理

1.sql語句許可權表 create table role id int not null auto increment comment id name varchar 20 not null comment 角色名稱 description varchar 200 comment 描述 prima...

shiro控制登入訪問許可權

步驟 1.在web.xml中配置 2.在spring mvc中配置 3.建立兩個實體類 在web層建立 實體類一 authrealm 繼承shrio包中的類 authorizingrealm authorizingrealm是realm的實現類之一 實體類二 customcredentialsmat...