在此,根据本项目实践。 将这个新的安全框架中遇到的问题。一一罗列。 仅供参考。
今天发现,采用Form 过滤器认证,需要采用“POST”方法,这个是启动表单认证的条件。在源码中有写到。
/** 174 * This default implementation merely returns <code>true</code> if the request is an HTTP <code>POST</code>, 175 * <code>false</code> otherwise. Can be overridden by subclasses for custom login submission detection behavior. 176 * 177 * @param request the incoming ServletRequest 178 * @param response the outgoing ServletResponse. 179 * @return <code>true</code> if the request is an HTTP <code>POST</code>, <code>false</code> otherwise. 180 */ 181 @SuppressWarnings({"UnusedDeclaration"}) 182 protected boolean isLoginSubmission(ServletRequest request, ServletResponse response) { 183 return (request instanceof HttpServletRequest) && WebUtils.toHttp(request).getMethod().equalsIgnoreCase(POST_METHOD); 184 } 185
Shiro的登录默认页为login.jsp ,成功登录跳转页面为"/",退出登录,只需要指定该路径为logout过滤器即可。 这些也可以在ini配置中修改。
[main] authc.successUrl=/content.html authc.loginUrl=/log.jsp [users] admin= admin [urls] /index.html = anon /logout=logout /** = authc