diff --git a/jams-server/src/main/java/net/jami/jams/server/Server.java b/jams-server/src/main/java/net/jami/jams/server/Server.java index 49c01881c622144281919fd76c940119cd9e55d2..f6a36edf69bb3386601402a4ddfda08cb471f94b 100644 --- a/jams-server/src/main/java/net/jami/jams/server/Server.java +++ b/jams-server/src/main/java/net/jami/jams/server/Server.java @@ -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()); diff --git a/ldap-connector/src/main/java/net/jami/jams/ldap/connector/service/UserProfileService.java b/ldap-connector/src/main/java/net/jami/jams/ldap/connector/service/UserProfileService.java index 1f1f04710a7cedb85b9eae15a5aac2d74b88afce..e0334e154e01efe62f5abdc48a777e495f5d74a2 100644 --- a/ldap-connector/src/main/java/net/jami/jams/ldap/connector/service/UserProfileService.java +++ b/ldap-connector/src/main/java/net/jami/jams/ldap/connector/service/UserProfileService.java @@ -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();