Problème connexion LDAP : AcceptSecurityContext error
Bonjour à tous,
J'ai une application Java sur laquelle je souhaite tester l'authentification de l'utilisateur via l'annuaire LDAP en passant son nom et son password.
J'ai un script VBS qui fonctionne bien de cette manière, le voici :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
msgbox (Verifi_Identit("ADMIN" , "PASS))
Function Verifi_Identit(login, Password)
On Error Resume Next
Err.Clear
Const ADS_SECURE_AUTHENTICATION = &H1
Set LDAPIdent = GetObject("LDAP:")
Set ADSObject = LDAPIdent.OpenDSObject("LDAP://MONSERVEUR:389/CN=MONGROUPE1,OU=MONGROUPE2,DC=MONDOMAINE,DC=fr", login, Password, ADS_SECURE_AUTHENTICATION)
Verifi_Identit = true
if Err.Number <> 0 then
Verifi_Identit = false
end if
End Function |
J'ai donc essayé de transposer ces mêmes informations en JAVA via le code suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
user = "ADMIN"
password = "PASS"
Boolean flag = false;
Hashtable environnementProperties = new Hashtable();
environnementProperties.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
environnementProperties.put(Context.SECURITY_AUTHENTICATION, "simple" );
environnementProperties.put(Context.PROVIDER_URL, "LDAP://MONSERVEUR:389/" );
environnementProperties.put(Context.SECURITY_PRINCIPAL, "CN=" + user +",CN=MONGROUPE1,OU=MONGROUPE2,DC=MONDOMAINE,DC=fr");
environnementProperties.put(Context.SECURITY_CREDENTIALS, password);
environnementProperties.put(Context.SECURITY_PROTOCOL, "simple");
try {
InitialDirContext contexte = new InitialDirContext(environnementProperties);
System.out.println("context initialiseD :" + contexte);
flag = true;
}
catch (NoInitialContextException e)
{
System.out.println("Problem de connection :" + e);
flag = false;
}
catch (NamingException e)
{
System.out.println("Problem getting attribute:" + e);
flag = false;
}
return flag;
} |
Mais j'ai cette erreur :
Citation:
javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 525, vece
Peut importe les identifiants / password que j’inscris, je pense donc à un problème dans mes informations de connexion au serveur LDAP, j'ai essayé de nombreuses combinaisons au niveau SECURITY_PRINCIPAL et PROVIDER_URL, en vain. Auriez vous une petite idée ?
D'avance merci !