Spring Security - откат к базовой аутентификации в случае сбоя Kerberos - PullRequest
0 голосов
/ 21 января 2019

Как включить откат к базовой аутентификации, если аутентификация Kerberos не выполняется (например, клиент не находится в домене)? В приведенной ниже конфигурации окно проверки подлинности браузера не появляется, и выдаются следующие исключения:

org.springframework.security.authentication.BadCredentialsException: Kerberos validation not successful
org.ietf.jgss.GSSException: Defective token detected (Mechanism level: GSSHeader did not find the right tag)

Соответствующая часть моей WebSecurityConfigurerAdapter реализации:

 @Override
 protected void configure(HttpSecurity http) throws Exception {
     http
             .exceptionHandling()
             .authenticationEntryPoint(spnegoEntryPoint())
             .and()
             .authorizeRequests()
             .anyRequest()
             .authenticated()
             .and()
             .logout()
             .permitAll()
             .and()
             .addFilterBefore(
                     spnegoAuthenticationProcessingFilter(),
                     BasicAuthenticationFilter.class);
    }

 @Bean
 public SpnegoEntryPoint spnegoEntryPoint() {
     return new SpnegoEntryPoint("/");
 }

@Bean
public SpnegoAuthenticationProcessingFilter spnegoAuthenticationProcessingFilter() {
    SpnegoAuthenticationProcessingFilter filter = new SpnegoAuthenticationProcessingFilter();
    try {
        filter.setAuthenticationManager(authenticationManagerBean());
    } catch (Exception e) {
        log.error("Failed to set AuthenticationManager on SpnegoAuthenticationProcessingFilter.", e);
    }
    return filter;
} 
...