【发布时间】:2016-09-08 21:38:04
【问题描述】:
我总是可以做一个@Secured("ROLE_A", "ROLE_B")。但是有没有办法从属性文件中填充 @Secured 注释值?类似于@Secured({property_a}, {property_b})。
谢谢。
【问题讨论】:
标签: spring spring-mvc spring-security spring-annotations
我总是可以做一个@Secured("ROLE_A", "ROLE_B")。但是有没有办法从属性文件中填充 @Secured 注释值?类似于@Secured({property_a}, {property_b})。
谢谢。
【问题讨论】:
标签: spring spring-mvc spring-security spring-annotations
使用@PreAuthorize。您可以将 Spring EL 表达式与有限的 @Secured 进行比较。
例子:
@PreAuthorize("#n == authentication.name")
Contact findContactByName(@Param("n") String name);
参考:
1)What's the difference between @Secured and @PreAuthorize in spring security 3
【讨论】: