You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2015/01/27 12:09:17 UTC
[1/2] karaf git commit: [KARAF-3373] Throw cause of LDAP connection
exception
Repository: karaf
Updated Branches:
refs/heads/master e8407547a -> cb7518351
[KARAF-3373] Throw cause of LDAP connection exception
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/f577967e
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/f577967e
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/f577967e
Branch: refs/heads/master
Commit: f577967e5e5a3feb55fab25b5c4335ca919a824e
Parents: e840754
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Tue Jan 27 12:07:40 2015 +0100
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Tue Jan 27 12:07:40 2015 +0100
----------------------------------------------------------------------
.../karaf/jaas/modules/ldap/LDAPLoginModule.java | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/f577967e/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 6b312c6..2ac7d1b 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
@@ -23,6 +23,7 @@ import org.osgi.framework.ServiceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.naming.CommunicationException;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.directory.*;
@@ -100,7 +101,7 @@ public class LDAPLoginModule extends AbstractKarafLoginModule {
connectionURL = (String) options.get(CONNECTION_URL);
connectionUsername = (String) options.get(CONNECTION_USERNAME);
connectionPassword = (String) options.get(CONNECTION_PASSWORD);
- userBaseDN = (String) options.get(USER_BASE_DN);
+ userBaseDN = (String) options.get(USER_BASE_DN);
userFilter = (String) options.get(USER_FILTER);
userSearchSubtree = Boolean.parseBoolean((String) options.get(USER_SEARCH_SUBTREE));
roleBaseDN = (String) options.get(ROLE_BASE_DN);
@@ -185,7 +186,7 @@ public class LDAPLoginModule extends AbstractKarafLoginModule {
user = ((NameCallback) callbacks[0]).getName();
char[] tmpPassword = ((PasswordCallback) callbacks[1]).getPassword();
-
+
// If either a username or password is specified don't allow authentication = "none".
// This is to prevent someone from logging into Karaf as any user without providing a
// valid password (because if authentication = none, the password could be any
@@ -196,7 +197,7 @@ public class LDAPLoginModule extends AbstractKarafLoginModule {
authentication = "simple";
}
if (!"none".equals(authentication) && !allowEmptyPasswords
- && (tmpPassword == null || tmpPassword.length ==0)) {
+ && (tmpPassword == null || tmpPassword.length == 0)) {
throw new LoginException("Empty passwords not allowed");
}
@@ -267,7 +268,7 @@ public class LDAPLoginModule extends AbstractKarafLoginModule {
// the second escapes the slashes correctly.
String userDN = result.getNameInNamespace().replace("," + userBaseDN, "");
String userDNNamespace = (String) result.getNameInNamespace();
- return new String[] { userDN, userDNNamespace };
+ return new String[]{userDN, userDNNamespace};
} finally {
if (namingEnumeration != null) {
try {
@@ -291,7 +292,15 @@ public class LDAPLoginModule extends AbstractKarafLoginModule {
}
userDN = userDnAndNamespace[0];
userDNNamespace = userDnAndNamespace[1];
+ } catch (CommunicationException ce) {
+ // explicitly catch CommunicationException as it my wrap a lower level root cause.
+ String rootCause = null;
+ if (ce.getRootCause() != null)
+ rootCause = ce.getRootCause().getMessage();
+ logger.warn("Can't connect to the LDAP server: {}", ce.getMessage(), rootCause);
+ throw new LoginException("Can't connect to the LDAP server: " + ce.getMessage());
} catch (Exception e) {
+ logger.warn("Can't connect to the LDAP server: {}", e.getMessage(), e);
throw new LoginException("Can't connect to the LDAP server: " + e.getMessage());
}
// step 2: bind the user using the DN
[2/2] karaf git commit: [KARAF-3439] Update failover lock delay
documentation
Posted by jb...@apache.org.
[KARAF-3439] Update failover lock delay documentation
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/cb751835
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/cb751835
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/cb751835
Branch: refs/heads/master
Commit: cb7518351c7407559a23fb91acd5def1ac65cb29
Parents: f577967
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Tue Jan 27 12:08:26 2015 +0100
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Tue Jan 27 12:08:26 2015 +0100
----------------------------------------------------------------------
manual/src/main/asciidoc/users-guide/failover.adoc | 12 ++++++------
manual/src/main/webapp/users-guide/failover.conf | 12 ++++++------
2 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/cb751835/manual/src/main/asciidoc/users-guide/failover.adoc
----------------------------------------------------------------------
diff --git a/manual/src/main/asciidoc/users-guide/failover.adoc b/manual/src/main/asciidoc/users-guide/failover.adoc
index 680e213..4bbee89 100644
--- a/manual/src/main/asciidoc/users-guide/failover.adoc
+++ b/manual/src/main/asciidoc/users-guide/failover.adoc
@@ -48,13 +48,13 @@ The configuration of the lock system has to be defined in the `etc/system.proper
karaf.lock=true
karaf.lock.class=org.apache.karaf.main.SimpleFileLock
karaf.lock.dir=<PathToLockFileDirectory>
-karaf.lock.delay=10
+karaf.lock.delay=10000
----
* `karaf.lock` property enables the the HA/failover mechanism
* `karaf.lock.class` property contains the class name providing the lock implementation. Here, we use the filesystem lock.
* `karaf.lock.dir` property contains the location where the lock will be written. All instances have to share the same lock.
-* `karaf.lock.delay` property is the interval period (in seconds) to check if the lock has been released or not.
+* `karaf.lock.delay` property is the interval period (in milliseconds) to check if the lock has been released or not.
=== Database lock
@@ -75,7 +75,7 @@ The database lock uses JDBC (Java DataBase Connectivity). To use database lockin
karaf.lock=true
karaf.lock.class=org.apache.karaf.main.DefaultJDBCLock
karaf.lock.level=50
-karaf.lock.delay=10
+karaf.lock.delay=10000
karaf.lock.jdbc.url=jdbc:derby://dbserver:1527/sample
karaf.lock.jdbc.driver=org.apache.derby.jdbc.ClientDriver
karaf.lock.jdbc.user=user
@@ -89,7 +89,7 @@ karaf.lock.jdbc.timeout=30
* `karaf.lock.class` property contains the class name providing the lock implementation. The `org.apache.karaf.main.DefaultJDBCLock`
is the most generic database lock system implementation. Apache Karaf supports lock system for specific databases (see later for details).
* `karaf.lock.level` property is the container-level locking (see later for details).
-* `karaf.lock.delay` property is the interval period (in seconds) to check if the lock has been released or not.
+* `karaf.lock.delay` property is the interval period (in milliseconds) to check if the lock has been released or not.
* `karaf.lock.jdbc.url` property contains the JDBC URL to the database (derby in this example).
* `karaf.lock.jdbc.driver` property contains the class name of the JDBC driver to use (derby in this example).
* `karaf.lock.jdbc.user` property contains the username to use to connect to the database.
@@ -194,7 +194,7 @@ Apache Karaf supports Microsoft SQLServer database for locking. The lock impleme
karaf.lock=true
karaf.lock.class=org.apache.karaf.main.lock.SQLServerJDBCLock
karaf.lock.level=50
-karaf.lock.delay=10
+karaf.lock.delay=10000
karaf.lock.jdbc.url=jdbc:jtds:sqlserver://127.0.0.1;databaseName=sample
karaf.lock.jdbc.driver=net.sourceforge.jtds.jdbc.Driver
karaf.lock.jdbc.user=user
@@ -240,4 +240,4 @@ Apache Karaf doesn't natively support cluster. By cluster, we mean several activ
However, [Apache Karaf Cellar|http://karaf.apache.org/index/subprojects/cellar.html] can be installed to provide cluster support.
-See the [Apache Karaf Cellar website|http://karaf.apache.org/index/subprojects/cellar.html] for details.
\ No newline at end of file
+See the [Apache Karaf Cellar website|http://karaf.apache.org/index/subprojects/cellar.html] for details.
http://git-wip-us.apache.org/repos/asf/karaf/blob/cb751835/manual/src/main/webapp/users-guide/failover.conf
----------------------------------------------------------------------
diff --git a/manual/src/main/webapp/users-guide/failover.conf b/manual/src/main/webapp/users-guide/failover.conf
index b35c636..aec800e 100644
--- a/manual/src/main/webapp/users-guide/failover.conf
+++ b/manual/src/main/webapp/users-guide/failover.conf
@@ -34,13 +34,13 @@ The configuration of the lock system has to be defined in the {{etc/system.prope
karaf.lock=true
karaf.lock.class=org.apache.karaf.main.SimpleFileLock
karaf.lock.dir=<PathToLockFileDirectory>
-karaf.lock.delay=10
+karaf.lock.delay=10000
{code}
* {{karaf.lock}} property enables the the HA/failover mechanism
* {{karaf.lock.class}} property contains the class name providing the lock implementation. Here, we use the filesystem lock.
* {{karaf.lock.dir}} property contains the location where the lock will be written. All instances have to share the same lock.
-* {{karaf.lock.delay}} property is the interval period (in seconds) to check if the lock has been released or not.
+* {{karaf.lock.delay}} property is the interval period (in milliseconds) to check if the lock has been released or not.
h3. Database lock
@@ -61,7 +61,7 @@ The database lock uses JDBC (Java DataBase Connectivity). To use database lockin
karaf.lock=true
karaf.lock.class=org.apache.karaf.main.DefaultJDBCLock
karaf.lock.level=50
-karaf.lock.delay=10
+karaf.lock.delay=10000
karaf.lock.jdbc.url=jdbc:derby://dbserver:1527/sample
karaf.lock.jdbc.driver=org.apache.derby.jdbc.ClientDriver
karaf.lock.jdbc.user=user
@@ -75,7 +75,7 @@ karaf.lock.jdbc.timeout=30
* {{karaf.lock.class}} property contains the class name providing the lock implementation. The {{org.apache.karaf.main.DefaultJDBCLock}}
is the most generic database lock system implementation. Apache Karaf supports lock system for specific databases (see later for details).
* {{karaf.lock.level}} property is the container-level locking (see later for details).
-* {{karaf.lock.delay}} property is the interval period (in seconds) to check if the lock has been released or not.
+* {{karaf.lock.delay}} property is the interval period (in milliseconds) to check if the lock has been released or not.
* {{karaf.lock.jdbc.url}} property contains the JDBC URL to the database (derby in this example).
* {{karaf.lock.jdbc.driver}} property contains the class name of the JDBC driver to use (derby in this example).
* {{karaf.lock.jdbc.user}} property contains the username to use to connect to the database.
@@ -180,7 +180,7 @@ Apache Karaf supports Microsoft SQLServer database for locking. The lock impleme
karaf.lock=true
karaf.lock.class=org.apache.karaf.main.lock.SQLServerJDBCLock
karaf.lock.level=50
-karaf.lock.delay=10
+karaf.lock.delay=10000
karaf.lock.jdbc.url=jdbc:jtds:sqlserver://127.0.0.1;databaseName=sample
karaf.lock.jdbc.driver=net.sourceforge.jtds.jdbc.Driver
karaf.lock.jdbc.user=user
@@ -226,4 +226,4 @@ Apache Karaf doesn't natively support cluster. By cluster, we mean several activ
However, [Apache Karaf Cellar|http://karaf.apache.org/index/subprojects/cellar.html] can be installed to provide cluster support.
-See the [Apache Karaf Cellar website|http://karaf.apache.org/index/subprojects/cellar.html] for details.
\ No newline at end of file
+See the [Apache Karaf Cellar website|http://karaf.apache.org/index/subprojects/cellar.html] for details.