Repository: karaf Updated Branches: refs/heads/karaf-2.3.x d0bd2d5fc -> f0fc95168
[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/f0fc9516 Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/f0fc9516 Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/f0fc9516 Branch: refs/heads/karaf-2.3.x Commit: f0fc95168b590d5ba3289af04088b988ad2ea1fc Parents: d0bd2d5 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:12 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/f0fc9516/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 2c587a8..846bcf8 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 @@ -59,6 +59,7 @@ public class LDAPLoginModule extends AbstractKarafLoginModule { public final static String ROLE_SEARCH_SUBTREE = "role.search.subtree"; public final static String AUTHENTICATION = "authentication"; 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"; @@ -176,8 +177,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) {
