shiro 无法跳转到unauthorizedUrl
来源:互联网 发布:淘宝卖家折800怎么报名 编辑:程序博客网 时间:2024/06/04 19:06
问题:shiro框架控制用户权限,用户权限认证未通过时,无法跳转到unauthorizedUrl对应的页面,直接抛出了异常。
原因:
- private void applyUnauthorizedUrlIfNecessary(Filter filter) {
- String unauthorizedUrl = getUnauthorizedUrl();
- if (StringUtils.hasText(unauthorizedUrl) && (filter instanceof AuthorizationFilter)) {
- AuthorizationFilter authzFilter = (AuthorizationFilter) filter;
- //only apply the unauthorizedUrl if they haven't explicitly configured one already:
- String existingUnauthorizedUrl = authzFilter.getUnauthorizedUrl();
- if (existingUnauthorizedUrl == null) {
- authzFilter.setUnauthorizedUrl(unauthorizedUrl);
- }
- }
- }
解决方案:
方案一:
<error-page>
<exception-type>org.apache.shiro.authz.UnauthorizedException</exception-type>
<location>/unauthorized.jsp</location>
</error-page>
方案二:使用perms,roles,ssl,rest,port
方案三:使用@ExceptionHandler(UnauthorizedException.class)
0 0
- shiro 无法跳转到unauthorizedUrl
- shiro unauthorizedUrl页面不跳转问题
- shiro unauthorizedUrl页面不跳转问题
- Application 无法跳转到 Activity
- shiro应用,注销掉后让系统跳转到后台登陆页
- shiro +springmvc无权限跳转到指定错误页面
- shiro不能跳转到登录前请求页面
- shiro 登录成功后 不跳转到 successUrl 的问题解决
- 我的shiro之旅: 十五 shiro 登录成功后,跳转到登录前的页面
- cd无法跳转到指定目录解决办法
- vs2008 无法跳转到函数声明处
- validationEngine ashx 无法 跳转到制定页面
- cd无法跳转到指定目录解决办法
- springmvc无法跳转到首页controller
- activity无法直接跳转到fragment中
- 跳转到新页面无法定位新元素
- iOS openURL 无法跳转到App Store
- 如何使用Shiro实现不同用户登录成功后跳转到不同主页?
- elasticsearch ingest node
- 阿里巴巴 JAVA 开发手册
- 2017年寒假实训
- tomcat7版本后访问tomcat下manager提示用户名和密码
- GIS技术 计算经纬度、距离、方位角
- shiro 无法跳转到unauthorizedUrl
- Spring AOP入门实例详解
- Centos7上HBase的安装和配置
- CodeForces - 620E New Year Tree DFS序列 线段树区间置数 状压
- 地区的三级联动写法
- Java web项目 在线网络考试考生考生注册部分代码
- javaScript实现焦点轮播图界面效果(二)
- 2016年个人经历流水总结-上半年
- 欢迎使用CSDN-markdown编辑器