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

最新文章

  1. SPFA
  2. WPF textblock加入超链接
  3. POJ2942 Knights of the Round Table(点双连通分量 + 二分图染色)
  4. phpstudy 安装选择,iis+php组合,如何设置伪静态
  5. Linux下安装php screw
  6. css在各浏览器中的兼容问题
  7. WPF之路一:相对路径图片显示
  8. IOT,笔记:avrdude: ser_open(): can&#39;t open device &quot;\\.\COM3&quot;: 系统找不到指定的文件。
  9. 20155206赵飞 基于《Arm试验箱的国密算法应用》课程设计个人报告
  10. 微信 获取wx.config 参数 基类
  11. react项目打包后路径找不到,项目打开后页面空白的问题
  12. [转帖]什么高速线缆DAC?有了有源光缆AOC为何还选择DAC?
  13. D. GCD Counting(树上dp)
  14. C++中bool类型变量初值对程序的影响
  15. 【Python】Python 猜年龄的游戏
  16. jq对页面元素进行排序
  17. 基于docker 搭建Elasticsearch5.6.4 分布式集群
  18. linux下mysql主从复制,实现数据库同步
  19. XSS-Proxy
  20. ES6初识-Proxy和Reflect

热门文章

  1. DP--HDU 1003(最大子串和)
  2. HDU 5167 Fibonacci 筛法+乱搞
  3. Java中final修饰符深入研究
  4. 守护线程以及要使用时注意的一点(Daemon Thread)
  5. DHCP:动态主机配置协议
  6. H5跳转到百度地图并定位
  7. HDU4790_Just Random
  8. codeforces 1023 D. Array Restoration 并查集
  9. 当对象使用sort时候 前提是实现compareTo的方法
  10. 洛谷 P1352 没有上司的舞会