Reputation: 6620
I have the following definition...
<bean id="fsi" class="org.springframework.security.intercept.web.FilterSecurityInterceptor">
<property name="authenticationManager" ref="authenticationManager"/>
<property name="accessDecisionManager" ref="httpRequestAccessDecisionManager"/>
<property name="objectDefinitionSource">
<sec:filter-invocation-definition-source >
<sec:intercept-url pattern="/secure/css/**" access="ROLE_TIER0"/>
<sec:intercept-url pattern="/secure/images/**" access="ROLE_TIER0"/>
<sec:intercept-url pattern="/**" access="ROLE_TIER0"/>
</sec:filter-invocation-definition-source>
</property>
</bean>
I'd like to have the resources on this url...
"/nonSecure/**"
Open to all calls, i.e. no security around it.
I've tried adding ...
<sec:intercept-url pattern="/nonsecure/**" access="permitAll" />
But this causes Websphere to throw an error about
Unsupported configuration attributes: [permitAll]
Can anyone tell me how to exclude this URL from security?
Upvotes: 39
Views: 78823
Reputation: 567
<security:http auto-config='true'>
<security:intercept-url pattern="/getfeed/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<security:intercept-url pattern="/**" access="ROLE_USER, ROLE_ADMIN" />
<security:http-basic />
</security:http>
access="IS_AUTHENTICATED_ANONYMOUSLY" Is the solution. I found it on the following link http://syntx.io/adding-http-basic-auth-to-restful-services-in-java-and-spring/
Intercepts are evaluated top down. If you write this /** before /getIntelFeed/** then all service would go through /** and security would be applied on all services. In such case /getIntelFeed/** would be ineffective.
Upvotes: 19
Reputation: 9845
Try:
<sec:intercept-url pattern="/nonsecure/**" filters="none" />
Upvotes: 17
Reputation: 16696
In spring security 3.1.x the use of filters="none" is deprecated. Instead you use multiple <http>
tags like this:
<http pattern="/nonsecure/**" security="none"/>
Upvotes: 86
Reputation: 10293
I think you have to add use-expressions
tag to your http
configuration in security xml for example:
<http auto-config="true" use-expressions="true">
...
...
</http>
Edit: Well I am not sure what version of spring security you are using. I know this works on 3.0 but for older versions I am not sure.
Upvotes: 24
Reputation: 6750
To be able to use expressions such as [permitAll] you have to add a a WebExpressionVoter to your AccessDecisionManager
Upvotes: 3
Reputation: 2638
You don't specify the rest of your configuration, and since it looks like you have explicit bean configuration, it's hard for us to guess exactly how you have things configured. I'll say that some combination of the above answers is correct.
Good luck!
Upvotes: 0