Jacob van Lingen
Jacob van Lingen

Reputation: 9537

Spring security 3 intercept-url pattern with index

I am trying to use Spring Security v3.2 for a project. At the moment I always use a coldfusion file that calls other files to build up the view. So all my urls go trough index.cfm?blablah.

Now I am stuck with allowing the anonymous user enter the home view. Following Spring Security request matcher is not working with regex, I made up the this code:

<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>

But whatever I try, I always enter the login field.

Upvotes: 3

Views: 10172

Answers (1)

Jacob van Lingen
Jacob van Lingen

Reputation: 9537

After more trying I found a solution:

<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>

Upvotes: 7

Related Questions