title: Ldap JWT loadUserByUsername
body: <p>Hello I'm trying to modifiy this example for LDAP authentification
  <a href="https://www.bezkoder.com/spring-boot-refresh-token-jwt/" rel="nofollow noreferrer">https://www.bezkoder.com/spring-boot-refresh-token-jwt/</a></p>
  <p><a href="https://github.com/bezkoder/spring-boot-refresh-token-jwt" rel="nofollow noreferrer">https://github.com/bezkoder/spring-boot-refresh-token-jwt</a></p>
  <p>I managed to hit the ldap by modifying my security config like that</p>
  <pre><code>@Override
      public void configure(AuthenticationManagerBuilder authenticationManagerBuilder) throws Exception {
          authenticationManagerBuilder.authenticationProvider(activeDirectoryLdapAuthenticationProvider());
      }
  
      @Bean
      public AuthenticationManager authenticationManager() {
          return new ProviderManager(Arrays.asList(activeDirectoryLdapAuthenticationProvider()));
      }
  
      @Bean
      public AuthenticationProvider activeDirectoryLdapAuthenticationProvider() {
          ActiveDirectoryLdapAuthenticationProvider provider = new ActiveDirectoryLdapAuthenticationProvider(
                  &quot;eu.domain&quot;, &quot;ldap://eu.domain:389&quot;);
          provider.setSearchFilter(&quot;(&amp;(objectClass=user)(sAMAccountName={1}))&quot;);
          provider.setUserDetailsContextMapper(userDetailsContextMapper());
          provider.setConvertSubErrorCodesToExceptions(true);
          provider.setUseAuthenticationRequestCredentials(true);
          return provider;
      }
  
      @Bean
      public UserDetailsContextMapper userDetailsContextMapper() {
          return new LdapUserDetailsMapper();
      }
  </code></pre>
  <p>I replaced occurence of UserDetails with LdapUserDetailsImpl</p>
  <p>I don't know how to replace userDetailsService.loadUserByUsername in AuthTokenFilter</p>