accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1454085 - in /accumulo/branches/1.5: core/src/main/java/org/apache/accumulo/core/security/handler/ZKAuthenticator.java server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java
Date Thu, 07 Mar 2013 20:28:23 GMT
Author: vines
Date: Thu Mar  7 20:28:23 2013
New Revision: 1454085

URL: http://svn.apache.org/r1454085
Log:
ACCUMULO-1161 - neglected how getPropertiesWithPrefix worked. Also, added some debug info
to login tokens


Modified:
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/security/handler/ZKAuthenticator.java
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java

Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/security/handler/ZKAuthenticator.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/security/handler/ZKAuthenticator.java?rev=1454085&r1=1454084&r2=1454085&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/security/handler/ZKAuthenticator.java
(original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/security/handler/ZKAuthenticator.java
Thu Mar  7 20:28:23 2013
@@ -26,17 +26,20 @@ import org.apache.accumulo.core.client.A
 import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode;
 import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.log4j.Logger;
 
 /**
  * 
  */
 public class ZKAuthenticator implements Authenticator {
+  Logger log = Logger.getLogger(ZKAuthenticator.class);
   
   @Override
   public AuthenticationToken login(Properties properties) throws AccumuloSecurityException
{
     if (properties.containsKey("password"))
       return new PasswordToken(properties.getProperty("password"));
-    throw new AccumuloSecurityException(properties.getProperty("user"), SecurityErrorCode.INSUFFICIENT_PROPERTIES);
+    
+    throw new AccumuloSecurityException(properties.getProperty("principal"), SecurityErrorCode.INSUFFICIENT_PROPERTIES);
   }
 
   @Override
@@ -44,6 +47,7 @@ public class ZKAuthenticator implements 
     List<Set<AuthProperty>> toRet = new LinkedList<Set<AuthProperty>>();
     Set<AuthProperty> internal = new TreeSet<AuthProperty>();
     internal.add(new AuthProperty("password", "the password for the principal", true));
+    internal.add(new AuthProperty("principal", "option field to provide the principal, mostly
used for better debug statements", false));
     toRet.add(internal);
     return toRet;
   }

Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java?rev=1454085&r1=1454084&r2=1454085&view=diff
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java
(original)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java
Thu Mar  7 20:28:23 2013
@@ -19,6 +19,7 @@ package org.apache.accumulo.server.monit
 import java.util.Date;
 import java.util.Map;
 import java.util.Properties;
+import java.util.Map.Entry;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -76,7 +77,12 @@ abstract class Basic extends BasicServle
       at = new PasswordToken(conf.get(Property.TRACE_PASSWORD).getBytes());
     else{
       Properties props = new Properties();
-      props.putAll(loginMap);
+      int prefixLength = Property.TRACE_LOGIN_PROPERTIES.getKey().length()+1;
+      for (Entry<String, String> entry : loginMap.entrySet()) {
+        props.put(entry.getKey().substring(prefixLength), entry.getValue());
+      }
+      if (!props.containsKey("principal"))
+        props.put("principal", principal);
       at = HdfsZooInstance.getInstance().getAuthenticator().login(props);
     }
     



Mime
View raw message