jackmew / spring-boot-security

This spring-boot-security is the project to record how I learn Spring Securtity taught by DTR Trading.
0 stars 3 forks source link

add method level role based security to the controller. #15

Closed jackmew closed 10 years ago

jackmew commented 10 years ago

link

image

set @EnableGlobalMethodSecurity(prePostEnabled=true) => 1. enable global method security 2. enable prePost

comment out //.antMatchers("/strategy/**").hasRole("ADMIN")

and you add @PreAuthorize("hasRole('ROLE_ADMIN')") to the controller you want authorise.