В Конкретном
Я хочу, чтобы HTTP-проверка подлинности ТОЛЬКО для определенного шаблона URL.
Подробно
Я создаю интерфейс API для своего приложения и должен быть аутентифицирован простой HTTP-аутентификацией. Но другие веб-страницы должны не использовать базовый HTTP, а скорее обычный вход в систему.
Текущая конфигурация - НЕ работает
@Override
protected void configure(HttpSecurity http) throws Exception {
http //HTTP Security
.csrf().disable() //Disable CSRF
.authorizeRequests() //Authorize Request Configuration
.antMatchers("/connect/**").permitAll()
.antMatchers("/", "/register").permitAll()
.antMatchers("/admin/**").hasRole("ADMIN")
.antMatchers("/api/**").hasRole("API")
.anyRequest().authenticated()
.and() //HTTP basic Authentication only for API
.antMatcher("/api/**").httpBasic()
.and() //Login Form configuration for all others
.formLogin().loginPage("/login").permitAll()
.and() //Logout Form configuration
.logout().permitAll();
}