Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/352.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 安全配置未保护所有终结点_Java_Spring Boot_Spring Security - Fatal编程技术网

Java 安全配置未保护所有终结点

Java 安全配置未保护所有终结点,java,spring-boot,spring-security,Java,Spring Boot,Spring Security,我想用jwt令牌保护每个端点,因此我创建了以下配置: @Configuration public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests()

我想用jwt令牌保护每个端点,因此我创建了以下配置:

@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .authorizeRequests()
                .anyRequest()
                .authenticated()
                .and()
                .oauth2ResourceServer()
                .jwt();
    }
}
这适用于post请求,但我的所有get请求仍然有效。当我在没有承载令牌的情况下执行get请求时,它仍然有效。
我做错了什么?

您是否在
SecurityConfig
中有
@覆盖
配置(WebSecurity web)
。如果是,请验证您没有在同一数据库中添加端点。