相关疑难解决方法(0)

Spring Boot 2.0禁用默认安全性

我想使用Spring Security进行JWT身份验证.但它带有默认身份验证.我试图禁用它,但是这样做的旧方法 - 禁用它application.properties- 在2.0中已弃用.

这是我试过的:

@Configuration
public class StackWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.httpBasic().disable();
        // http.authorizeRequests().anyRequest().permitAll(); // Also doesn't work.
    }
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能简单地禁用基本安全性?

更新
可能很高兴知道我不使用web mvc而是web flux.

截图:
基本登录表单

spring-security spring-boot spring-security-rest spring-webflux

28
推荐指数
6
解决办法
4万
查看次数