Skip to content
Snippets Groups Projects
Commit 4a61bd39 authored by Felix Sidokhine's avatar Felix Sidokhine
Browse files

fixed the specials chars problem with LDAP, possibly may need to add this to AD

parent 0cc4e2d6
No related branches found
No related tags found
No related merge requests found
......@@ -57,11 +57,11 @@ public class Server {
try {
InputStream path;
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
path = classLoader.getResourceAsStream("adsampleconfig.json");
userAuthenticationModule.attachADAuthSource(new String(path.readAllBytes()));
path = classLoader.getResourceAsStream("ldapconfig.json");
userAuthenticationModule.attachLDAPAuthSource(new String(path.readAllBytes()));
UserProfile[] userProfile = userAuthenticationModule.getAuthenticationSources()
.get(new AuthModuleKey("SAVOIRFAIRELINU", AuthenticationSourceType.AD))
.getUserProfile("Sidokhine","FULL_TEXT_NAME");
.get(new AuthModuleKey("savoirfairelinux", AuthenticationSourceType.LDAP))
.getUserProfile("Félix","FULL_TEXT_NAME");
System.out.println(userProfile[0]);
} catch (Exception e) {
log.error("Could not load and inject active directory connector with error: " + e.toString());
......
......@@ -5,6 +5,9 @@ import net.jami.jams.common.objects.user.UserProfile;
import net.jami.jams.ldap.connector.LDAPConnector;
import org.ldaptive.*;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.text.Normalizer;
import java.util.HashMap;
@Slf4j
......@@ -33,6 +36,7 @@ public class UserProfileService {
UserProfile[] profiles = null;
Connection connection = null;
try {
queryString = URLEncoder.encode(queryString,StandardCharsets.UTF_8).replace("%","\\");
connection = connectionFactory.getConnection();
try {
connection.open();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment