1.shrio filter AccessControlFilter
重写 方法 :protected abstract boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception
@Override protected boolean onAccessDenied(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; if (!"XMLHttpRequest".equalsIgnoreCase(request .getHeader("X-Requested-With"))) {// 不是ajax请求 return super.onAccessDenied(servletRequest, servletResponse); } String url = request.getRequestURL().toString(); String contextPath = request.getContextPath(); url = url.substring(0, (url.indexOf(contextPath) + contextPath.length())); String urls = casUrl + "/login?service=" + url; log.info("ajax session timeout url-----------" + urls); response.setContentType("text/html;charset=UTF-8"); response.getWriter().write(urls); return false; }
把要跳转的路径 返回给ajax;
ajax 在error中 接收:
$.ajax({ type : "post", data : paramsStr, url : reqUrl, dataType : "json", success : function(jsonData) { callback(jsonData); }, error : function(e) { var errorText = e.responseText; if (errorText != undefined && errorText != "" && errorText.indexOf("login?service") > 0) { window.location.href = e.responseText; } else { alertOperFailure(); } } });
相关推荐
// 配置不会被拦截的链接 顺序判断 filterChainDefinitionMap.put("/static/**", "anon"); filterChainDefinitionMap.put("/public/**", "anon"); filterChainDefinitionMap.put("/ajaxLogin", "anon"); ...
通过 thymeleaf 和 shiro 对用户和管理员的权限进行管理。JAVA个人理财管理系统源码可用作毕业设计。该项目是针对个人的理财系统。对于用户主要分为四个模块:登录/注册、理财产品、金融工具和个人中心。登录和注册...
通过 thymeleaf 和 shiro 对用户和管理员的权限进行管理。 软件架构 理财管理软件架构说明 后端:SpringBoot、Mybatis; 前端:thymeleaf、Html、CSS、BootStarp; 数据库:MySql; 服务器:Tomcat; 安全组件:...
通过 thymeleaf 和 shiro 对用户和管理员的权限进行管理。 基于springboot+thymeleaf的个人理财记账管理系统源码+数据库(毕业设计).zip 也可作为期末大作业和课程设计,代码完整下载即用,无需修改确保可以运行。...
行政springboot 2.1 + shiro + redis + layUI后台权限管理系统【一直以来,欠大家的升级版,终于来了】springboot 2.1版本wyait-admin:【博客】 管理Sprint Boot子1.5 + mybatis + shiro + layui :【博客】 ;...
核心技术采用Spring、MyBatis、Shiro没有任何其它重度依赖。 互联网云快速开发框架,微服务分布式代码生成的敏捷开发系统架构。项目代码简洁,注释丰富,上手容易,还同时集中分布式、微服务,同时包含许多基础模块和监控...
登录和注册主要采用 shiro 来进行拦截和验证用户信息。用户可以通过发送 Ajax请求来买入或撤销理财产品。并且也可以在金融工具查看资金记录并且也可以申请网贷。用户可以在个人中心修改自己的个人信息,也可以查看...
核心技术采用Spring、MyBatis、Shiro没有任何其它重度依赖。 互联网云快速开发框架,微服务分布式代码生成的敏捷开发系统架构。项目代码简洁,注释丰富,上手容易,还同时集中分布式、微服务,同时包含许多基础模块和监控...
- Spring Boot 权限认证,包括 Apache Shiro、Spring Security - springboot-cloud - Spring Cloud 入门,包括 Eureka(服务注册与发现)、Config(配置中心)、Hystrix(断路器)、Bus(消息总线) 等
核心技术采用Spring、MyBatis、Shiro没有任何其它重度依赖。 互联网云快速开发框架,微服务分布式代码生成的敏捷开发系统架构。项目代码简洁,注释丰富,上手容易,还同时集中分布式、微服务,同时包含许多基础模块和监控...