How do I programmatically test authorization for URLs in Spring Security?
I'm using Spring security 3.0.5 in a JSF 2 application.
In order to deactivate/hide entries in my navigation menu 开发者_运维技巧for users that are not permitted to access them, I need a way to programmatically test whether the currently logged in user is allowed to access a given URL.
What's the easiest way to do that?
I've found the solution myself: the API for this functionality is found in WebInvocationPrivilegeEvaluator
, which can be acquired via an @Autowired
spring bean.
精彩评论