LostMohican
LostMohican

Reputation: 3142

How can i get the url to be fetched in AccessDecisionVoter implementation of vote method?

I am using Spring Security for role based access controls for urls that are matching with controllers.

I want to create a system where some of the urls are checked for a users permissions. I have already created a custom access decision voter and using it in a custom access decision manager. But up to now I could not have been able to get the actual urls I want to check.

Is it possible for an access decision voter to get the actual url that is being voted? Can i use the Object o parameter specified in the vote interface method?

Thanks

Upvotes: 2

Views: 1084

Answers (1)

Grzegorz Rożniecki
Grzegorz Rożniecki

Reputation: 28045

I think I responded your question in this answer. Basically implement AccessDecisionVoter<FilterInvocation>, override supports(Class<?> clazz) to return true only for FilterInvocation objects and in vote method second parameter you'll have FilterInvocation object with getRequestUrl() method which is what you are looking for.

Upvotes: 6

Related Questions