我想授权所有REST调用,除了路径中带有“ hello”的任何内容。但是,我所有的PUT调用都被“禁止”。 我在这里想念什么?
image.setImageResource(array[i])
}
@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Autowired
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("user1").password(passwordEncoder().encode("user1Pass"))
.authorities("USER");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/**/hello").authenticated().anyRequest().permitAll().and().httpBasic();
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}