You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by di...@apache.org on 2014/02/10 22:50:33 UTC

git commit: KNOX-253: og error message for exception ldapContextFactory.getSystemLdapContext()

Updated Branches:
  refs/heads/master 32a88702f -> 2c72ac5fd


KNOX-253: og error message for exception ldapContextFactory.getSystemLdapContext()


Project: http://git-wip-us.apache.org/repos/asf/incubator-knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-knox/commit/2c72ac5f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-knox/tree/2c72ac5f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-knox/diff/2c72ac5f

Branch: refs/heads/master
Commit: 2c72ac5fd605ec26e7bf2ee9a7e274aa39077f5a
Parents: 32a8870
Author: Dilli Dorai Arumugam <da...@hortonworks.com>
Authored: Mon Feb 10 13:46:29 2014 -0800
Committer: Dilli Dorai Arumugam <da...@hortonworks.com>
Committed: Mon Feb 10 13:49:12 2014 -0800

----------------------------------------------------------------------
 .../apache/hadoop/gateway/shirorealm/KnoxLdapRealm.java   | 10 +++++++---
 .../java/org/apache/hadoop/gateway/GatewayMessages.java   |  3 +++
 2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2c72ac5f/gateway-provider-security-shiro/src/main/java/org/apache/hadoop/gateway/shirorealm/KnoxLdapRealm.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-shiro/src/main/java/org/apache/hadoop/gateway/shirorealm/KnoxLdapRealm.java b/gateway-provider-security-shiro/src/main/java/org/apache/hadoop/gateway/shirorealm/KnoxLdapRealm.java
index f5845bd..4d2236b 100644
--- a/gateway-provider-security-shiro/src/main/java/org/apache/hadoop/gateway/shirorealm/KnoxLdapRealm.java
+++ b/gateway-provider-security-shiro/src/main/java/org/apache/hadoop/gateway/shirorealm/KnoxLdapRealm.java
@@ -40,6 +40,8 @@ import javax.naming.directory.SearchResult;
 import javax.naming.ldap.LdapContext;
 import javax.naming.ldap.LdapName;
 
+import org.apache.hadoop.gateway.GatewayMessages;
+import org.apache.hadoop.gateway.i18n.messages.MessagesFactory;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.authz.AuthorizationInfo;
 import org.apache.shiro.authz.SimpleAuthorizationInfo;
@@ -99,6 +101,8 @@ import org.apache.shiro.util.StringUtils;
  */
 public class KnoxLdapRealm extends JndiLdapRealm {
 
+    private static GatewayMessages LOG = MessagesFactory.get( GatewayMessages.class );
+  
     private static final String MEMBER_SUBSTITUTION_TOKEN = "{0}";
     private final static SearchControls SUBTREE_SCOPE = new SearchControls();
     private final static SearchControls ONELEVEL_SCOPE = new SearchControls();
@@ -167,9 +171,9 @@ public class KnoxLdapRealm extends JndiLdapRealm {
         try {
             systemLdapCtx = ldapContextFactory.getSystemLdapContext();
             return rolesFor(username, systemLdapCtx, ldapContextFactory);
-        } catch (AuthenticationException ex) {
-            // principal was not authenticated on LDAP
-            return Collections.emptySet();
+        } catch (AuthenticationException e) {
+          LOG.failedToGetSystemLdapConnection(e);
+          return Collections.emptySet();
         } finally {
             LdapUtils.closeContext(systemLdapCtx);
         }

http://git-wip-us.apache.org/repos/asf/incubator-knox/blob/2c72ac5f/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayMessages.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayMessages.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayMessages.java
index 174a353..34d191d 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayMessages.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayMessages.java
@@ -297,4 +297,7 @@ public interface GatewayMessages {
 
   @Message( level = MessageLevel.WARN, text = "Failed to match path {0}" )
   void failedToMatchPath( String path );
+  
+  @Message( level = MessageLevel.ERROR, text = "Failed to get system ldap connection: {0}" )
+  void failedToGetSystemLdapConnection( @StackTrace( level = MessageLevel.DEBUG ) Exception e );
 }