我有一个SecurityConfig,我使用JWT令牌授权了请求。问题是我想关闭安全性配置以测试我的websocket,因为我总是会收到401 ...
我添加了:
@SpringBootApplication(exclude = SecurityConfig.class)
@EnableAutoConfiguration
public class MyApp {
但是它仍在授权来自websockets的请求,基本上也可以休息...
任何人都知道如何在春季切换安全性,或者也许如何允许websockets消息?
问候
您可以添加
导入org.springframework.context.annotation.Configuration;导入org.springframework.security.config.annotation.web.builders.WebSecurity;导入org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@配置公共类ApplicationSecurity扩展了WebSecurityConfigurerAdapter {
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/**");
}
}