0

如果用户没有给定的权限并且还想将他限制在一个页面上,我想允许 100 个 url,我该如何使用 spring security 来做到这一点,或者有人可以帮助我使用 antMatchers() 继续我的要求, 先感谢您。

protected void configure(HttpSecurity http) throws Exception {
     http 
    .authorizeRequests() .antMatchers("/p1/**").permitAll() 
 .antMatchers("/p2","/p3","/p4").wantRestrictIfItHasRole.access("hasRole('ROLEA')") 
    .anyRequest().authenticated();
}
4

0 回答 0