所以,我有这个在我的WebSecurityConfigurerAdapter
public class ApiWebSecurityConfigurationAdapter extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
// Use this configuration for endpoints starting with 'api'
.antMatcher("/api/**")
// Do not secure endpoints receiving callbacks
.authorizeRequests().antMatchers(""/api/v1/notification").permitAll()
// Allow only users with role "ROLE_API"
.anyRequest().hasRole(Users.UserRoles.ROLE_API.role.replace("ROLE_", ""))
.and()
.httpBasic()
.and()
// Do not create any sessions
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
// Disable csrf
.csrf().disable();
}
}
这不应该安全。如果我在标头中没有调用该终结点,则允许请求,但是如果我添加标头,则会收到 http 响应代码。/api/v1/notificationAuthorization: Basic abcdHTTPAuthorization: Basic abcd401
注意:只是随机的,所以没有这样的用户在我的数据库中Basic abcd
问题是,为什么添加 http 标头会使端点再次受到保护?Authorization...
POPMUISE
相关分类