You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2016/08/02 18:32:20 UTC
svn commit: r1754985 - in /manifoldcf/trunk: CHANGES.txt
connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java
Author: kwright
Date: Tue Aug 2 18:32:20 2016
New Revision: 1754985
URL: http://svn.apache.org/viewvc?rev=1754985&view=rev
Log:
Fix for CONNECTORS-1329. Committed on behalf of Furkan KAMACI.
Modified:
manifoldcf/trunk/CHANGES.txt
manifoldcf/trunk/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java
Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1754985&r1=1754984&r2=1754985&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Tue Aug 2 18:32:20 2016
@@ -3,6 +3,9 @@ $Id$
======================= 2.5-dev =====================
+CONNECTORS-1329: Add logging to LDAP connector.
+(Furkan KAMACI)
+
CONNECTORS-1326: Fix URL for Confluence documents.
(Chalitha Perera)
Modified: manifoldcf/trunk/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java?rev=1754985&r1=1754984&r2=1754985&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java (original)
+++ manifoldcf/trunk/connectors/ldap/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/ldap/LDAPAuthority.java Tue Aug 2 18:32:20 2016
@@ -151,30 +151,39 @@ public class LDAPAuthority extends org.a
try {
if (session == null) {
if (serverName == null || serverName.length() == 0) {
+ Logging.authorityConnectors.error("Server name parameter missing but required");
throw new ManifoldCFException("Server name parameter missing but required");
}
if (serverPort == null || serverPort.length() == 0) {
+ Logging.authorityConnectors.error("Server port parameter missing but required");
throw new ManifoldCFException("Server port parameter missing but required");
}
if (serverBase == null) {
+ Logging.authorityConnectors.error("Server base parameter missing but required");
throw new ManifoldCFException("Server base parameter missing but required");
}
if (userBase == null) {
+ Logging.authorityConnectors.error("User base parameter missing but required");
throw new ManifoldCFException("User base parameter missing but required");
}
if (userSearch == null || userSearch.length() == 0) {
+ Logging.authorityConnectors.error("User search expression missing but required");
throw new ManifoldCFException("User search expression missing but required");
}
if (groupBase == null) {
+ Logging.authorityConnectors.error("Group base parameter missing but required");
throw new ManifoldCFException("Group base parameter missing but required");
}
if (groupSearch == null || groupSearch.length() == 0) {
+ Logging.authorityConnectors.error("Group search expression missing but required");
throw new ManifoldCFException("Group search expression missing but required");
}
if (groupNameAttr == null || groupNameAttr.length() == 0) {
+ Logging.authorityConnectors.error("Group name attribute missing but required");
throw new ManifoldCFException("Group name attribute missing but required");
}
if (userNameAttr == null || userNameAttr.length() == 0) {
+ Logging.authorityConnectors.error("User name attribute missing but required");
throw new ManifoldCFException("User name attribute missing but required");
}
@@ -217,6 +226,7 @@ public class LDAPAuthority extends org.a
env.put(Context.SECURITY_CREDENTIALS, bindPass);
}
+ Logging.authorityConnectors.info("LDAP Context environment properties: " + Arrays.toString(env.entrySet().toArray()));
session = new InitialLdapContext(env, null);
if (useTls) {
@@ -235,22 +245,27 @@ public class LDAPAuthority extends org.a
} catch (AuthenticationException e) {
session = null;
sessionExpirationTime = -1L;
+ Logging.authorityConnectors.error("Authentication error: " + e.getMessage() + ", explanation: " + e.getExplanation(), e);
throw new ManifoldCFException("Authentication error: " + e.getMessage() + ", explanation: " + e.getExplanation(), e);
} catch (CommunicationException e) {
session = null;
sessionExpirationTime = -1L;
+ Logging.authorityConnectors.error("Communication error: " + e.getMessage(), e);
throw new ManifoldCFException("Communication error: " + e.getMessage(), e);
} catch (NamingException e) {
session = null;
sessionExpirationTime = -1L;
+ Logging.authorityConnectors.error("Naming error: " + e.getMessage(), e);
throw new ManifoldCFException("Naming error: " + e.getMessage(), e);
} catch (InterruptedIOException e) {
session = null;
sessionExpirationTime = -1L;
+ Logging.authorityConnectors.error("Interrupted IO error: " + e.getMessage());
throw new ManifoldCFException(e.getMessage(), ManifoldCFException.INTERRUPTED);
} catch (IOException e) {
session = null;
sessionExpirationTime = -1L;
+ Logging.authorityConnectors.error("IO error: " + e.getMessage(), e);
throw new ManifoldCFException("IO error: " + e.getMessage(), e);
}
}
@@ -453,6 +468,7 @@ public class LDAPAuthority extends org.a
} catch (NameNotFoundException e) {
// This means that the user doesn't exist
+ Logging.authorityConnectors.error("Response Unreachable: "+e.getMessage(),e);
return RESPONSE_USERNOTFOUND;
} catch (NamingException e) {
// Unreachable
@@ -787,11 +803,9 @@ public class LDAPAuthority extends org.a
*
* @param ctx is the ldap context to use.
* @param userName (Domain Logon Name) is the user name or identifier.
- * @param searchBase (Full Domain Name for the search ie:
* DC=qa-ad-76,DC=metacarta,DC=com)
* @return SearchResult for given domain user logon name. (Should throws an
- * exception if user is not found.)
- */
+ * exception if user is not found.) */
protected SearchResult getUserEntry(LdapContext ctx, String userName)
throws ManifoldCFException {
String searchFilter = userSearch.replaceAll("\\{0\\}", escapeDN(userName.split("@")[0]));