SpringBoot 2.7.8 Проверка подлинности бесконечного цикла в BadCredentialsException при использовании ActiveDirectoryLdapAuthenticationProvider

Нужна помощь!

Цикл со stackowerflow только при неудачной авторизации через AD

1 аутентификация: 201, ProviderManager (org.springframework.security.authentication) [5]

          @Bean
    public ActiveDirectoryLdapAuthenticationProvider getLdapAuthenticationProvider() {

        BindAuthenticator bindAuthenticator = new BindAuthenticator(contextSource());
        bindAuthenticator.setUserDnPatterns(new String[]{userDNPattern});

        ActiveDirectoryLdapAuthenticationProvider authenticationProvider =
                new ActiveDirectoryLdapAuthenticationProvider(null, ldapUrl, ldapPartitionSuffix);

        authenticationProvider.setConvertSubErrorCodesToExceptions(true);
        authenticationProvider.setUseAuthenticationRequestCredentials(true);

        if (userDNPattern != null && userDNPattern.trim().length() > 0) {
            authenticationProvider.setSearchFilter(userDNPattern);
        }

        return authenticationProvider;
    }

    @Bean
    public AuthenticationManager authManager(HttpSecurity http) throws Exception {

        AuthenticationManagerBuilder authBuilder = http.getSharedObject(AuthenticationManagerBuilder.class);

        authBuilder.authenticationProvider(getLdapAuthenticationProvider());

        return authBuilder.build();
    }

0 ответов

Другие вопросы по тегам