Spring Boot + Spring Security: Notes: @ PreAuthorize, @ PostAuthorize, @Secured, EL implementation Safety - Part 20

Demand origin

         In the previous section we introduced the control authority of the notes by the way, here again a detailed explanation of the method-level security under a few notes.

 

First, open the annotation type method-level security

         We need to add configuration WebSecuirtyConfig:

@Configuration
@EnableWebSecurity //启用Spring Security.

////会拦截注解了@PreAuthrize注解的配置.
@EnableGlobalMethodSecurity(prePostEnabled=true)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter{

}

Second, allow comments

         Here the main @PreAuthorize, @PostAuthorize, @Secured three notes can be used.

Guess you like

Origin blog.csdn.net/linxingliang/article/details/104969840