cas+shiro不进行时时去cas验证身份信息,需要用shiro在当前系统有一份完整的认证机构。那么有一个问题,什么时候去cas校验信息,目前的配置方式: cas系统设置默认的浏览器session存活时间,当前系统的session存活时间为30分钟,那么当当前系统身份验证失败 ...
cas+shiro不进行时时去cas验证身份信息,需要用shiro在当前系统有一份完整的认证机构。
那么有一个问题,什么时候去cas校验信息,目前的配置方式:
cas系统设置默认的浏览器session存活时间,当前系统的session存活时间为30分钟,那么当当前系统身份验证失败是,去cas校验。
这里涉及到一个非常重要的节点,就是shiro框架内部是怎么进行cas校验的呢,请看代码:
org.apache.shiro.web.filter.AccessControlFilterd还是所有默认验证类的父类,
父类中的redirectToLogin方法就是去请求cas服务器,重新获取验证信息
/** * Convenience method for subclasses that merely acquires the {@link #getLoginUrl() getLoginUrl} and redirects * the request to that url. * <p/> * <b>N.B.</b> If you want to issue a redirect with the intention of allowing the user to then return to their * originally requested URL, don't use this method directly. Instead you should call * {@link #saveRequestAndRedirectToLogin(javax.servlet.ServletRequest, javax.servlet.ServletResponse) * saveRequestAndRedirectToLogin(request,response)}, which will save the current request state so that it can * be reconstructed and re-used after a successful login. * * @param request the incoming <code>ServletRequest</code> * @param response the outgoing <code>ServletResponse</code> * @throws IOException if an error occurs. */ protected void redirectToLogin(ServletRequest request, ServletResponse response) throws IOException { String loginUrl = getLoginUrl(); WebUtils.issueRedirect(request, response, loginUrl); }
原标题:cas+shiro实现不时时的去请求cas进行身份验证
关键词:Shiro
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。