You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2014/07/16 15:23:34 UTC

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

Repository: karaf
Updated Branches:
  refs/heads/master 2cb768244 -> ac8f887c7


[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/ac8f887c
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/ac8f887c
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/ac8f887c

Branch: refs/heads/master
Commit: ac8f887c724a2f05bc2210248092afab9fd50b1d
Parents: 2cb7682
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:23:08 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/ac8f887c/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..7b2c020 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<>();
         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) {