Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bypass Spring Security Filter for URL

I modified my applicationContext-security-preauth.xml with the goal of removing filters from a particular URL.

I'm having trouble with the spring-security-oauth filter, so I want to temporarily avoid using this filter for particular requests.

<intercept-url pattern="/notsecure/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/>

After building and copying the new JAR, and then refreshing Tomcat, my /notsecure/ HTTP requests still hit this filter, according to my logs.

I would not have expected for any filter to be hit given my configuration change.

EDIT: I'm using Spring Security 2

like image 551
Kevin Meredith Avatar asked Jan 25 '26 03:01

Kevin Meredith


1 Answers

If you want to avoid hitting any filters for that URL you will need an additional <http> element like this:

<security:http pattern="/notsecure/**" security="none"/>

(This will work only with Spring Security 3.1+)

IS_AUTHENTICATED_ANONYMOUSLY requires that the request is anonymously authenticated which is done by a filter (namely the AnonymousAuthenticationFilter).

like image 79
zagyi Avatar answered Jan 27 '26 01:01

zagyi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!