I have two patterns for which same filters are to be applied.
<security:filter-chain pattern="/home.do*" filters="a,b,c,d" />
<security:filter-chain pattern="/login.do*" filters="a,b,c,d" />
Along with the above two there are many other unique patterns and a generic pattern /**/*.do*/** as well.
Can I specify comma separated multiple patterns in the pattern attribute like below:
<security:filter-chain pattern="/home.do*, /login.do*" filters="a,b,c,d" />
Yes you can, but the implementation depends on Spring Security version you are using.
In 3.0 you can use
path-typeattribute:In 3.1 you can either use
request-matcherattribute (which deprecatespath-type, just change path-type to request matcher in previous example), or you can use multiplehttpelements withrequest-matcher-refbean and do this:with your custom implementation of
CommaSeparatedRequestMatcher(which splits URL created from request and triest to match any string), based on, for example,RegexRequestMatcher.