我向我的spring boot后端添加了一个自我认证的ssl证书,但之后我得到了一个 403 forbidden
我的请求出错。
安全配置:
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
DataSource dataSource;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.jdbcAuthentication().dataSource(dataSource)
.usersByUsernameQuery("select username,password,enabled from users where username=?")
.authoritiesByUsernameQuery("select username, role from authorities where username=?");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
http.authorizeRequests()
.anyRequest().authenticated();
http.requiresChannel().anyRequest().requiresSecure();
}
}
暂无答案!
目前还没有任何答案,快来回答吧!