title: Spring LDAP authentication bad credentials password in Salted SHA type
body: <p>I have a project for LDAP authentication with REST service. My LDAP configuration have Salted SHA (SSHA) password hash method. In Spring's LDAP authentication best practice guide supporting SHA method when I used that I got bad credentials while crendentials are ok. </p>
  
  <p>My configuration class reference:</p>
  
  <pre><code>@Configuration
  public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
  
      @Override
      public void configure(AuthenticationManagerBuilder auth) throws Exception {
          auth
              .ldapAuthentication()
                  .userSearchFilter("uid={0}")
                  .contextSource(contextSource())
                  .passwordCompare()
                      .passwordEncoder(new LdapShaPasswordEncoder())
                      .passwordAttribute("userPassword");
      }
  
      @Bean
      public DefaultSpringSecurityContextSource contextSource() {
          return new DefaultSpringSecurityContextSource(Arrays.asList("ldap://localhost:8389/"), "dc=springframework,dc=org");
      }
  }
  </code></pre>
  
  <p>My ldif configuration;</p>
  
  <pre><code>dn: uid=ben,ou=people,dc=springframework,dc=org
  objectclass: top
  objectclass: person
  objectclass: organizationalPerson
  objectclass: inetOrgPerson
  cn: Ben Alex
  sn: Alex
  uid: ben
  userPassword: {SSHA}pcFdFhO/NS98EhTRup60PMkHMWFRDkJ3jUu1Zg==
  </code></pre>
  
  <p>My original password is <code>Test1234</code>. My <code>pom.xml</code> file ;</p>
  
  <pre><code>   &lt;dependency&gt;
         &lt;groupId&gt;org.springframework.ldap&lt;/groupId&gt;
         &lt;artifactId&gt;spring-ldap-core&lt;/artifactId&gt;
     &lt;/dependency&gt;
     &lt;dependency&gt;
         &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
         &lt;artifactId&gt;spring-security-ldap&lt;/artifactId&gt;
     &lt;/dependency&gt;
     &lt;dependency&gt;
         &lt;groupId&gt;com.unboundid&lt;/groupId&gt;
         &lt;artifactId&gt;unboundid-ldapsdk&lt;/artifactId&gt;
     &lt;/dependency&gt;
  </code></pre>
  
  <p>How can I authenticate with my username/password to ldap server with SSHA password encryption?</p>