I can always do a @Secured("ROLE_A", "ROLE_B")
. But is there a way to populate the @Secured
annotation values from a properties file? Something like @Secured({property_a}, {property_b})
.
Thank you.
Use @PreAuthorize. You can put an Spring EL expresssion compare to @Secured which is limited.
Example :
@PreAuthorize("#n == authentication.name")
Contact findContactByName(@Param("n") String name);
Reference :
1) What's the difference between @Secured and @PreAuthorize in spring security 3
2) Spring EL