无法在SpringBootApplication中关闭SecurityConfig

问题描述 投票:0回答:1

我有一个SecurityConfig,我使用JWT令牌授权了请求。问题是我想关闭安全性配置以测试我的websocket,因为我总是会收到401 ...

我添加了:

@SpringBootApplication(exclude = SecurityConfig.class)
@EnableAutoConfiguration
public class MyApp {

但是它仍在授权来自websockets的请求,基本上也可以休息...

任何人都知道如何在春季切换安全性,或者也许如何允许websockets消息?

问候

spring security spring-security jwt
1个回答
0
投票

您可以添加

导入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("/**");
}

}

© www.soinside.com 2019 - 2024. All rights reserved.