Spring boot仅对特定web服务进行基本身份验证
我正在使用SpringBootBasicAuth生成x-auth-token 我的配置方法如下所示: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
@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