salut ,
j'utilise JNDI pour recuperer les users depuis Active directory.
j'ai pu récuperer tout les champs sauf les mot de passe.

pouvez vous m'aider?.

voici le code

voici le code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
//specify the LDAP search filter
String searchFilter = "(&(objectClass=user)(mail=*))";
 
//Specify the Base for the search
String searchBase = "DC=crmei,DC=dtt";
 
//initialize counter to total the results
int totalResults = 0;
// Search for objects using the filter
NamingEnumeration answer = ctx.search(searchBase, searchFilter,searchCtls);
//Loop through the search results
while (answer.hasMoreElements()) {
SearchResult sr = (SearchResult)answer.next();
totalResults++;
System.out.println(">>>" + sr.getName());
// Print out some of the attributes, catch the exception if the attributes have no values
Attributes attrs = sr.getAttributes();
if (attrs != null) {
try { 
System.out.println(" displayName: " + attrs.get("displayName").get());
} 
catch (NullPointerException e) 
{
}
try {
System.out.println(" userPassword: " + attrs.get("unicodePwd").get());
}
}
Merci