jpganz18
jpganz18

Reputation: 5858

how to secure 2 paths at same time with spring security?

I have this issue.

There is a configuration in spring security

<intercept-url pattern="/profile" access="ROLE_PROFILE" />

Works as expected...

Then, for some reasons (I cannot change) , there is another url

/myurl/profile

both /profile and /myurl/profile are answered by the same controller and do exactly the same, only the url changes, and the profile of access is the same.

I tried to do this

 <intercept-url pattern="*/profile" access="ROLE_PROFILE" />

But doesnt work, also tried with **. Is there any way I do this configuration without have to add a new line? (are about 50 rules to add), Can I specify more than one pattern to intercept?

Upvotes: 0

Views: 184

Answers (1)

Amit Bhati
Amit Bhati

Reputation: 5649

Use this /**/profile, it should intercept both /myurl/profile and /profile.

Your code will look something like below:-

   <intercept-url pattern="/**/profile" access="ROLE_PROFILE" />

Upvotes: 2

Related Questions