regex - Spring security 3 带索引的拦截url模式

标签 regex spring spring-security

我正在尝试在项目中使用 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/

相关文章:

php - 使用 PHP 将 URLS 中的空格替换为 %20

spring-boot - 在 CORS spring security + webFlux 中启用通配符

java - Spring 安全 session 超时

java - 试图为我的查询找到合适的正则表达式

java - Flex 正则表达式 到 Java 正则表达式

regex - 使用正则表达式 notepad2 将字符添加到字符串的末尾

java - 如何为 Spring Data JPA 查询设置默认架构名称?

spring - 在请求写入完成之前,WebClient 不会读取响应。

java - Hibernate + Spring with Oracle - 使用分层查询(START WITH + CONNECT BY)

java - Spring Resttemplate登录失败