2016-05-16 16 views
0

私は、Spring Security 4とJavaの設定でLDAP認証を実装しようとしています。Javaの設定でのLDAP認証

<ldap-authentication-provider> 
     <password-compare hash="{ssha}"/> 
    </ldap-authentication-provider> 

答えて

1
@Configuration 
@EnableWebSecurity 
public class PasswordCompareLdapConfig extends WebSecurityConfigurerAdapter { 
    protected void registerAuthentication(
      AuthenticationManagerBuilder auth) throws Exception { 
     auth 
      .ldapAuthentication() 
       .passwordCompare() 
        .passwordEncoder(new BaseDigestPasswordEncoder()) 
        .passwordAttribute("userPassword"); 
    } 
} 
+0

「私はそれが新しいShaPasswordEncoder(だと思う – esonat

+0

「タイプのBaseDigestPasswordEncoderをインスタンス化できません」)とShaPasswordEncoder.IためsetEncodeHashAsBase64(true)を設定する必要があります。Javaの設定では、このXMLの同等は何 それが動作するかどうかを確認します。 – esonat

+0

あなたはおそらく正しいでしょう。私はちょうどサンプルの注釈を貼り付けましたconfig..feelそれの答えを更新するために自由にあなたのために働く – Shibashis