- Приложение Spring Boot с Springfox
- Добавление аутентификации BASIC в Swagger
Передавать все остальные запросы
Код: Выделить всё
@EnableWebSecurity
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/swagger-resources/*", "*.html", "/api/v1/swagger.json")
.hasAuthority("SWAGGER")
.anyRequest().permitAll()
.and()
.httpBasic()
.and()
.csrf().disable();
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("admin").password("admin").authorities("SWAGGER");
}
}
Вопрос: почему аутентификация и пользователь BASIC не применяются к конечной точке пользовательского интерфейса Swagger?
Подробнее здесь: https://stackoverflow.com/questions/500 ... g-boot-app