开发者

How do I programmatically test authorization for URLs in Spring Security?

开发者 https://www.devze.com 2023-02-05 05:56 出处:网络
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 prog

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消