一、shiro的配置

1、shiro的web过滤
实例化ShiroFilterFactoryBean
设置securityManager、loginUrl、unauthorizedUrl、sucessUrl、filters、filterChainDefinitions

2、securityManager安全管理器
配置realm、配置sessionManager属性(class:DefaultWebSessionManager)、cacheManager(暂时不了解)

3、realm
设置realm属性(继承 AuthorizingRealm

登录可重写 doGetAuthenticationInfo(AuthenticationToken token) return  new SimpleAuthenticationInfo(token.getUsername(), token.getPassword(), getName());

授权方面可重写 doGetAuthorizationInfo(PrincipalCollection principals)  return  SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();

SimpleAuthorizationInfo 通过addStringPermission(String) 设置用户权限(后台controller方法头上加  @RequiresPermissions("base:organization:button:edit"),前台 <shiro:hasPermission name="base:menu:button:add"></shiro:hasPermission> )

)
4、设置sessionManager(DefaultWebSessionManager)

globalSessionTimeout 登录过期时间

sessionIdCookieEnabled 是否启用sessionId的cookie(不启用不执行simpleCookie)

sessionDAO 暂时不懂

sessionIdCookie (SimpleCookie),可设置构造参数name属性,设置session名

  simpleCookie类 通过 addCookieHeader方法,根据name属性,生成请求头 name=sessionId

最新文章

  1. 微信接口-获取用户openid基本信息
  2. C+命令行+方向键=简易版扫雷
  3. IOS网络编程。。
  4. all things are difficult before they are easy
  5. android Log 等级以及在Android Studio 的Logcat中过滤方法
  6. include_path详细解析
  7. android学习日记10--裁剪区域
  8. WLLCM这五个字母全排列数目
  9. SQL Server 2012学习笔记 1 命令行安装
  10. KICKSTART无人值守安装 - (字符界面操作)
  11. 从“思考”的角度来看如何成为一名优质的Java架构师
  12. 在linux上安装dotnetcore
  13. 什么是C/S模式与B/S模式,两者区别与优缺点
  14. Rsync + inotify 实现文件实时同步
  15. small_trick_on_IT/PC
  16. CentOS7学习记录(工具使用篇)
  17. delphi 结构体和TList的用法
  18. 『OpenCV3』处理视频&amp;摄像头
  19. 记录一次因为意外断电造成gitlab(docker容器)重启之后无法访问的问题
  20. C#_串口通信_SerialPort_一个最基础的串口程序

热门文章

  1. 标准库函数gets()和puts()
  2. Vue中注意target和currentTarget的使用
  3. cropper.js
  4. HotSpot VM的堆结构
  5. Python中异常和JSON读写数据
  6. 源码分析系列1:HashMap源码分析(基于JDK1.8)
  7. leetcode-hard-array- 227. Basic Calculator II
  8. ubuntu安装相关
  9. 如何实现一个串行promise
  10. PreparedStatement执行sql語句