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