karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject git commit: [KARAF-3052] Allow passing through custom ldap properties
Date Wed, 16 Jul 2014 13:26:44 GMT
Repository: karaf
Updated Branches:
  refs/heads/karaf-3.0.x 27f331bb8 -> 1ac656cc5


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

Branch: refs/heads/karaf-3.0.x
Commit: 1ac656cc5c1de0a9d4d45356a3a693f1dbe50e26
Parents: 27f331b
Author: Guillaume Nodet <gnodet@gmail.com>
Authored: Wed Jul 16 15:23:08 2014 +0200
Committer: Guillaume Nodet <gnodet@gmail.com>
Committed: Wed Jul 16 15:26:36 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/1ac656cc/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) {


Mime
View raw message