当前位置: 代码迷 >> 综合 >> SpringBoot、Mybatis加Shiro
  详细解决方案

SpringBoot、Mybatis加Shiro

热度:39   发布时间:2024-01-19 14:19:44.0

当web程序验证用户名和密码时,会向Shiro中的Realm提供用户名和密码。

作为真正进行认证授权的环节,Realm得到Shiro提供的用户名及密码后,会向ini文件或者数据库的用户表去检索。

 

写一个XXXRealm类,继承AuthorizingRealm抽象类,实现两个抽象方法

即 protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection); 授权

和 protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException; 验证

 

 

  相关解决方案