1

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.

Sajib Acharya
  • 1,666
  • 5
  • 29
  • 54

1 Answers1

1

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

Community
  • 1
  • 1
FreezY
  • 1,641
  • 2
  • 18
  • 31