spring security 3 多页面登录 小秘密小运气

首先 多谢这两篇文章的作者

一:http://www.iteye.com/topic/1113842 多页面登录
二:http://blog.csdn.net/k10509806/article/details/6436987 filter测试
如果跟着上面都不成功 实现多页面登录需求的话, 下面可能的好的哦!

最近,好想搞 spring security 3 前后台 多页面登录,跟着他们来配 不起用!

我的 MyLoginUrlEntryPoint implements AuthenticationEntryPoint就是进不去commence方法,,,观察后

, 和我的运气 测试得到了最 秘密(是因为我在文档查不到,找不到)的 配置

首先,不用配entry-point-ref="loginUrlEntryPoint" 直接
<http use-expressions="true" auto-config="true" access-denied-page="/error.jsp">

第二:在 某个地方的区别
<beans:property name="filterProcessesUrl" value="/j_spring_security_check"/>
<beans:property name="filterProcessesUrl" value ="/cms/j_spring_security_check"/>

第三:在 两个登录页的区别
action="${pageContext.request.contextPath}/j_spring_security_check">
action="${pageContext.request.contextPath }/cms/j_spring_security_check">


最后:因为用了auto-config= "true"  所以,不能用 position="FORM_LOGIN_FILTER" ref="adminLoginFilter"/>
而是:

<custom-filter before="FORM_LOGIN_FILTER" ref="loginFilter"/> 
        <custom-filter after="FORM_LOGIN_FILTER" ref="adminLoginFilter"/>


就是这四步的区别,与第一篇文章! 其他代码几乎一样! 如果你的helloworld运行起来就可以来配这个了!


真的好奇怪啊!我的运气这么好!好,我要把我的运气分给大家分享这个小秘密!

不知道这的原理,刚学了1个月吧,

我这里的运行完全 符合需求,两个页两个targetPage,错误直到本页,没权去ERRORpage

猜你喜欢

转载自tonytony3.iteye.com/blog/1214081