You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jg...@apache.org on 2014/07/26 03:52:08 UTC

[26/50] git commit: [KARAF-3052] Allow passing through custom ldap properties

[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/remotes/karaf-2.3.x
Commit: f0fc95168b590d5ba3289af04088b988ad2ea1fc
Parents: d0bd2d5
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Wed Jul 16 15:23:08 2014 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
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) {