Shiro实战教程(一)
Shiro完整架构图
Shiro认证过程
Shiro授权的内部处理机制
Shiro 支持三种方式的授权
1.编程式:通过写if/else 授权代码块完成:
Subject subject = SecurityUtils.getSubject();
if(subject.hasRole(“admin”)) {
//有权限
} else {
//无权限
}
2.注解式:通过在执行的Java方法上放置相应的注解完成:
@RequiresRoles("admin")
public void hello() {
//有权限
}
3.JSP/GSP 标签:在JSP/GSP 页面通过相应的标签完成:
<shiro:hasRole name="admin">
<!— 有权限—>
</shiro:hasRole>
实际与web系统集成使用后两种方式
shiro的过虑器
过滤器简称 |
对应的java类 |
anon |
org.apache.shiro.web.filter.authc.AnonymousFilter |
authc |
org.apache.shiro.web.filter.authc.FormAuthenticationFilter |
authcBasic |
org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter |
perms |
org.apache.shiro.web.filter.authz.PermissionsAuthorizationFilter |
port |
org.apache.shiro.web.filter.authz.PortFilter |
rest |
org.apache.shiro.web.filter.authz.HttpMethodPermissionFilter |
roles |
org.apache.shiro.web.filter.authz.RolesAuthorizationFilter |
ssl |
org.apache.shiro.web.filter.authz.SslFilter |
user |
org.apache.shiro.web.filter.authc.UserFilter |
logout |
org.apache.shiro.web.filter.authc.LogoutFilter |
资料
https://www.cnblogs.com/niaobulashi/p/springboot-shiro.html
最新文章
- SPFA
- WPF textblock加入超链接
- POJ2942 Knights of the Round Table(点双连通分量 + 二分图染色)
- phpstudy 安装选择,iis+php组合,如何设置伪静态
- Linux下安装php screw
- css在各浏览器中的兼容问题
- WPF之路一:相对路径图片显示
- IOT,笔记:avrdude: ser_open(): can&#39;t open device ";\\.\COM3";: 系统找不到指定的文件。
- 20155206赵飞 基于《Arm试验箱的国密算法应用》课程设计个人报告
- 微信 获取wx.config 参数 基类
- react项目打包后路径找不到,项目打开后页面空白的问题
- [转帖]什么高速线缆DAC?有了有源光缆AOC为何还选择DAC?
- D. GCD Counting(树上dp)
- C++中bool类型变量初值对程序的影响
- 【Python】Python 猜年龄的游戏
- jq对页面元素进行排序
- 基于docker 搭建Elasticsearch5.6.4 分布式集群
- linux下mysql主从复制,实现数据库同步
- XSS-Proxy
- ES6初识-Proxy和Reflect