knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dillido...@apache.org
Subject git commit: KNOX-383: log computed bind dn and the mechanism to help diagnostics
Date Wed, 21 May 2014 17:52:48 GMT
Repository: knox
Updated Branches:
  refs/heads/master 8100d409e -> b38d5f944


KNOX-383: log computed bind dn and the mechanism to help diagnostics


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

Branch: refs/heads/master
Commit: b38d5f9442dd05aabb391deb68d958293e3f4268
Parents: 8100d40
Author: Dilli Dorai Arumugam <darumugam@hortonworks.com>
Authored: Wed May 21 10:45:09 2014 -0700
Committer: Dilli Dorai Arumugam <darumugam@hortonworks.com>
Committed: Wed May 21 10:46:35 2014 -0700

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


http://git-wip-us.apache.org/repos/asf/knox/blob/b38d5f94/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 7d8c028..a71fb30 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
@@ -472,12 +472,14 @@ public class KnoxLdapRealm extends JndiLdapRealm {
      */
     @Override
     protected String getUserDn(String principal) throws IllegalArgumentException, IllegalStateException
{
+      String userDn = null;
       if (userSearchAttributeName == null || userSearchAttributeName.isEmpty()) {
-        return super.getUserDn(principal);
+        userDn = super.getUserDn(principal);
+        LOG.computedUserDn(userDn, principal);
+        return userDn;
       }
 
       // search for userDn and return
-      String userDn = null;
       LdapContext systemLdapCtx = null;
       try {
           systemLdapCtx = getContextFactory().getSystemLdapContext();
@@ -489,7 +491,9 @@ public class KnoxLdapRealm extends JndiLdapRealm {
               SUBTREE_SCOPE);
           if (searchResultEnum.hasMore()) { // searchResults contains all the groups in search
scope
             SearchResult searchResult =  searchResultEnum.next();
-            return searchResult.getNameInNamespace();
+            userDn = searchResult.getNameInNamespace();
+            LOG.searchedAndFoundUserDn(userDn, principal);
+            return userDn;
           } else {
             throw new IllegalArgumentException("Illegal principal name: " + principal);
           }

http://git-wip-us.apache.org/repos/asf/knox/blob/b38d5f94/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 d1d79c0..9abc835 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
@@ -316,4 +316,10 @@ public interface GatewayMessages {
   @Message( level = MessageLevel.WARN, text = "Value not found for cluster:{0}, alias: {1}"
)
   void aliasValueNotFound( String cluster, String alias );
 
+  @Message( level = MessageLevel.INFO, text = "Computed userDn: {0} using dnTemplate for
principal: {1}" )
+  void computedUserDn(String userDn, String principal);
+
+  @Message( level = MessageLevel.INFO, text = "Computed userDn: {0} using ldapSearch for
principal: {1}" )
+  void searchedAndFoundUserDn(String userDn, String principal);
+
 }


Mime
View raw message