Repository: karaf Updated Branches: refs/heads/karaf-2.x 2ac1d5a1d -> 05802faa7
[KARAF-3052] Allow passing through custom ldap properties Project: http://git-wip-us.apache.org/repos/asf/karaf/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/05802faa Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/05802faa Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/05802faa Branch: refs/heads/karaf-2.x Commit: 05802faa76d36e8773b866bf25c056330b8a37d9 Parents: 2ac1d5a Author: Guillaume Nodet <[email protected]> Authored: Wed Jul 16 15:23:08 2014 +0200 Committer: Guillaume Nodet <[email protected]> Committed: Wed Jul 16 15:27:30 2014 +0200 ---------------------------------------------------------------------- .../org/apache/karaf/jaas/modules/ldap/LDAPLoginModule.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf/blob/05802faa/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPLoginModule.java ---------------------------------------------------------------------- diff --git a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPLoginModule.java b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPLoginModule.java index a5ae1ea..19d5e52 100644 --- a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPLoginModule.java +++ b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/ldap/LDAPLoginModule.java @@ -60,6 +60,7 @@ public class LDAPLoginModule extends AbstractKarafLoginModule { public final static String AUTHENTICATION = "authentication"; public final static String ALLOW_EMPTY_PASSWORDS = "allowEmptyPasswords"; public final static String INITIAL_CONTEXT_FACTORY = "initial.context.factory"; + public static final String CONTEXT_PREFIX = "context."; public final static String SSL = "ssl"; public final static String SSL_PROVIDER = "ssl.provider"; public final static String SSL_PROTOCOL = "ssl.protocol"; @@ -183,8 +184,13 @@ public class LDAPLoginModule extends AbstractKarafLoginModule { principals = new HashSet<Principal>(); // step 1: get the user DN - Hashtable env = new Hashtable(); + Hashtable<String, Object> env = new Hashtable<String, Object>(); logger.debug("Create the LDAP initial context."); + for (String key : options.keySet()) { + if (key.startsWith(CONTEXT_PREFIX)) { + env.put(key.substring(CONTEXT_PREFIX.length()), options.get(key)); + } + } env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory); env.put(Context.PROVIDER_URL, connectionURL); if (connectionUsername != null && connectionUsername.trim().length() > 0) {
