实例讲解shiro登录认证和权限控制
程序员文章站
2022-03-19 20:31:36
...
一、实现类继承AuthorizingRealm
1、实现方法doGetAuthenticationInfo,将定义的用户实体类填充map,realmPrincipals;
2、实现方法doGetAuthorizationInfo,填充roles ,Permissions;
二,创建subject
提供SecurityUtils getSubject 方式创建,securityManager.createSubject,SubjectContext中进行确认map中已经存在securityManager,session以及PrincipalCollection,最后DefaultWebSubjectFactory创建webDelegatingSubject,并保存到session中。
三、登录验证
登录创建,DelegatingSubject login方法执行securityManager login,创建同第二步。
四、登出
DelegatingSubject logout方法执行securityManager logout,删除session中的subject,stop session。
五、关于ModularRealmAuthenticator
ModularRealmAuthenticator类在项目启动时setRealms(第一步中定义,不清楚为什么项目启动时注入),doSingleRealmAuthentication方法调用realm的doGetAuthorizationInfo
以上就是实例讲解shiro登录认证和权限控制的详细内容,更多请关注其它相关文章!
推荐阅读
-
SpringBoot和Redis实现Token权限认证的实例讲解
-
Apache Shiro(一)-登录认证和权限管理初识
-
Spring Boot (十四): Spring Boot 整合 Shiro-登录认证和权限管理
-
springboot+shiro实现用户登录认证和权限管理(二)
-
Apache Shiro(一)-登录认证和权限管理初识
-
php中Zend_Auth和Zend_Acl进行登录认证及根据用户角色进行权限控制 (1/4)_PHP教程
-
SpringBoot和Redis实现Token权限认证的实例讲解
-
Spring Boot (十四): Spring Boot 整合 Shiro-登录认证和权限管理
-
实例讲解shiro登录认证和权限控制
-
实例讲解shiro登录认证和权限控制