我正在尝试在项目中使用 Spring Security v3.2。目前,我总是使用 Coldfusion 文件来调用其他文件来构建 View 。所以我所有的网址都通过 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>
但无论我尝试什么,我总是输入登录字段。
最佳答案
经过多次尝试,我找到了解决方案:
<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>
关于regex - Spring security 3 带索引的拦截url模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16686818/