如何从数据库Oracl中的表中获取Spring Security授权请求值

时间:2019-05-27 22:22:05

标签: spring security

替换网址:“ / admin / **” 从数据库获取表值

替换ROL:“ ADMIN” 从数据库获取表值

下面是示例代码:

protected void configure(HttpSecurity http) throws Exception {
http
    .authorizeRequests()                                                                
        .antMatchers("/resources/**", "/signup", "/about").permitAll()                  
        .antMatchers("/admin/**").hasRole("ADMIN")                                      
        .antMatchers("/db/**").access("hasRole('ADMIN') and hasRole('DBA')")            
        .anyRequest().authenticated()                                                   
        .and()
    // ...
    .formLogin();
}

0 个答案:

没有答案