Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.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
Spring boot仅对特定web服务进行基本身份验证_Spring_Spring Boot - Fatal编程技术网

Spring boot仅对特定web服务进行基本身份验证

Spring boot仅对特定web服务进行基本身份验证,spring,spring-boot,Spring,Spring Boot,我正在使用SpringBootBasicAuth生成x-auth-token 我的配置方法如下所示: @Override protected void configure(HttpSecurity http) throws Exception { http .addFilterBefore(new CORSFilter(), ChannelProcessingFilter.class) .authoriz

我正在使用SpringBootBasicAuth生成x-auth-token

我的配置方法如下所示:

 @Override
    protected void configure(HttpSecurity http) throws Exception {
        http     
        .addFilterBefore(new CORSFilter(), ChannelProcessingFilter.class)        
            .authorizeRequests()            
            .anyRequest().authenticated()
            .and()
            .requestCache()
            .requestCache(new NullRequestCache())
            .and()
            .httpBasic();

        http.csrf().disable();        
    }

  @Bean
    public HttpSessionStrategy httpSessionStrategy() {
        return new HeaderHttpSessionStrategy();
    }  
我也有RestController,其中定义了API

curl-v-u用户名:密码

curl-v-u用户名:密码

通过使用上述组合,我能够生成x-auth-token,但我希望只有一个方法/API可以生成x-auth-token

并非所有api都应生成x-auth-token