我正在尝试在项目中使用 Spring Security v3.2。目前,我总是使用 Coldfusion 文件来调用其他文件来构建视图。所以我所有的网址都通过了index.cfm?blablah
.
现在我坚持允许匿名用户进入主视图。下列的Spring Security 请求匹配器无法与正则表达式一起使用 https://stackoverflow.com/questions/13503944/spring-security-request-matcher-is-not-working-with-regex?answertab=votes#tab-top,我编写了这段代码:
<http use-expressions="true">
<intercept-url pattern="^.*index.cfm\?action=home.*$" access="permitAll" />
<intercept-url pattern="/root/index.cfm" access="isAuthenticated()" />
<intercept-url pattern="/**" access="isAuthenticated()" />
<form-login />
</http>
但无论我尝试什么,我总是输入登录字段。
经过更多尝试我找到了解决方案:
<http request-matcher="regex" pattern="^.*index.cfm\?action=home.*$" security="none"/>
<http use-expressions="true">
<intercept-url pattern="/root/index.cfm" access="isAuthenticated()" />
<intercept-url pattern="/root/**" access="permitAll" />
<intercept-url pattern="/**" access="isAuthenticated()" />
<form-login />
</http>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)