我正在尝试将Spring Security v3.2用于项目。目前我总是使用coldfusion文件调用其他文件来构建视图。所以我的所有网址都通过index.cfm?blablah
。
现在我很难让匿名用户进入主视图。在Spring Security request matcher is not working with regex之后,我编写了这段代码:
<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>
但无论我尝试什么,我总是进入登录栏。
答案 0 :(得分:8)
经过多次尝试后,我找到了解决方案:
<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>