Bonjour,

J'ai un annuaire OpenLDAP qui contient les password des utilisateurs stockés en SHA.

je voudrais authentifier ma JCR (Jackrabbit) sur cet annuaire.

voici le code que j'ai utilisé (qui fonctionne correctement quand le pass LDAP est stocké en claire !) :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
getRepository().login(new SimpleCredentials(user.getLogin(), user.getPassword().toCharArray()), user.getLogin());
j'obtiens cette erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
Caused by: javax.naming.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]
	at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3005)
	at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2951)
	at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2753)
	at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2667)
	at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:287)
	at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
	at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
	at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
	at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
et
Code : Sélectionner tout - Visualiser dans une fenêtre à part
_session = getRepository().login(new CryptedSimpleCredentials(user.getLogin(), user.getPassword()), user.getLogin());
j'ai cette exception :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
javax.security.auth.login.LoginException: Error: javax.security.auth.callback.NameCallback@1308b26 not available to acquire authentication information from the user
	at com.sun.security.auth.module.LdapLoginModule.getUsernamePassword(LdapLoginModule.java:974)
	at com.sun.security.auth.module.LdapLoginModule.attemptAuthentication(LdapLoginModule.java:729)
	at com.sun.security.auth.module.LdapLoginModule.login(LdapLoginModule.java:551)

ma configuration repository.xml

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
<LoginModule class="com.sun.security.auth.module.LdapLoginModule">
          <!--<LoginModule class="org.jboss.security.auth.spi.LdapLoginModule">-->
	        <param name="userProvider" value="ldap://ldap.host.com/ou=xxxCommunity,dc=xxx,dc=com"/>
   	        <param name="authIdentity" value="uid={USERNAME},ou=xxxCommunity,dc=xxx,dc=com"/>
   	        <param name="useSSL" value="false"/>
   	        <param name="debug" value="false"/>
        </LoginModule>
Quelqu'un peut m'aider pour que je puisse m'authentifier ?
Merci