zoukankan      html  css  js  c++  java
  • spring security 5.x去除默认前缀

       
      .antMatchers("/**/users/admin/**").access("hasAnyRole('ADMIN')")
    .antMatchers("/**/users/test/**").access("hasAnyRole('USER')")

    .antMatchers("/**/users/test/**").hasRole('USER')
    
    
     
    @EnableGlobalMethodSecurity(prePostEnabled = true, proxyTargetClass = true)//启用方法级的权限认证
    @EnableWebSecurity
    public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

    /** * 干掉默认的授权前缀 * 工作方式.access("hasRole('USER')")而不是 hasRole('USER') */ @Bean GrantedAuthorityDefaults grantedAuthorityDefaults() { return new GrantedAuthorityDefaults(""); // Remove the ROLE_ prefix }
    }
  • 相关阅读:
    1219 总结
    1206 冲刺三
    1130 冲刺2
    1128 主页面
    1123 冲刺3
    1121 冲刺2
    1118 冲刺1
    1117 新冲刺
    0622 软件工程总结
    0617 实验四 主存空间的分配和回收
  • 原文地址:https://www.cnblogs.com/Mr-lin66/p/13157492.html
Copyright © 2011-2022 走看看