Olivier.Roger
Olivier.Roger

Reputation: 4249

Spring Security - Apply pattern to custom http filter?

I use Spring Security 3.0 and I would like to define a Basic Authentication filter only on a specific subset of URLs in my application.

Is it possible to add a pattern to custom-filters ?

I would like to add a pattern attribute like this :

<security:custom-filter ref="basicAuthenticationFilter" position="BASIC_AUTH_FILTER" pattern="/services/**"/>

I saw it is possible to use filters attribute on intercept-url but I would not have to list them all.

Upvotes: 1

Views: 1926

Answers (1)

Olivier.Roger
Olivier.Roger

Reputation: 4249

I used a filer-chain-map to solve this issue.

    <security:filter-chain-map path-type="ant">
        <security:filter-chain pattern="/ws/**" filters="basicAuthenticationFilter"/>
    </security:filter-chain-map>

There might be a better solution though.

Upvotes: 1

Related Questions