accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1461330 - in /accumulo/branches/1.5: core/src/main/java/org/apache/accumulo/core/cli/ core/src/main/java/org/apache/accumulo/core/client/ core/src/main/java/org/apache/accumulo/core/client/mock/ core/src/main/java/org/apache/accumulo/core/...
Date Tue, 26 Mar 2013 21:51:56 GMT
Author: vines
Date: Tue Mar 26 21:51:55 2013
New Revision: 1461330

URL: http://svn.apache.org/r1461330
Log:
ACCUMULO-259 - Ripping principal out of ZKAuthenticator login properties and made principal
part of the login interface


Modified:
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/Instance.java
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/security/handler/Authenticator.java
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/security/handler/InsecureAuthenticator.java
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/security/handler/ZKAuthenticator.java
    accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
    accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
    accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java

Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java?rev=1461330&r1=1461329&r2=1461330&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
(original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
Tue Mar 26 21:51:55 2013
@@ -123,7 +123,7 @@ public class ClientOpts extends Help {
         props.put(loginOption.getKey(), loginOption.getValue());
       
       try {
-        return getInstance().getAuthenticator().login(props);
+        return getInstance().getAuthenticator().login(principal, props);
       } catch (AccumuloSecurityException e) {
         throw new RuntimeException(e);
       } catch (AccumuloException e) {

Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/Instance.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/Instance.java?rev=1461330&r1=1461329&r2=1461330&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/Instance.java
(original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/Instance.java
Tue Mar 26 21:51:55 2013
@@ -164,7 +164,7 @@ public interface Instance {
    * @param principal
    * @param token
    *          A known SecurityToken type. If uncertain which should be provided, use {@link
#getAuthenticatorClassName()} and
-   *          {@link Authenticator#login(Properties)}
+   *          {@link Authenticator#login(String, Properties)}
    * @throws AccumuloException
    * @throws AccumuloSecurityException
    * @since 1.5.0
@@ -184,7 +184,7 @@ public interface Instance {
   
   /**
    * 
-   * @return Returns the corresponding Authenticator class, which can be used to create a
token ({@link Authenticator#login(Properties)} or get a list of
+   * @return Returns the corresponding Authenticator class, which can be used to create a
token ({@link Authenticator#login(String, Properties)} or get a list of
    *         required properties {@link Authenticator#getProperties()}
    * @throws AccumuloException
    * @throws AccumuloSecurityException

Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java?rev=1461330&r1=1461329&r2=1461330&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
(original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
Tue Mar 26 21:51:55 2013
@@ -234,7 +234,7 @@ public class ZooKeeperInstance implement
   
   public Connector getConnector(String principal, Properties props) throws AccumuloException,
AccumuloSecurityException {
     Authenticator authenticator = getAuthenticator();
-    AuthenticationToken authToken = authenticator.login(props);
+    AuthenticationToken authToken = authenticator.login(principal, props);
     return getConnector(principal, authToken);
   }
   

Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java?rev=1461330&r1=1461329&r2=1461330&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
(original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
Tue Mar 26 21:51:55 2013
@@ -170,7 +170,7 @@ public class MockInstance implements Ins
   
   @Override
   public Connector getConnector(String principal, Properties props) throws AccumuloException,
AccumuloSecurityException {
-    return getConnector(principal, getAuthenticator().login(props));
+    return getConnector(principal, getAuthenticator().login(principal, props));
   }
   
   @Override

Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/security/handler/Authenticator.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/security/handler/Authenticator.java?rev=1461330&r1=1461329&r2=1461330&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/security/handler/Authenticator.java
(original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/security/handler/Authenticator.java
Tue Mar 26 21:51:55 2013
@@ -24,7 +24,7 @@ import org.apache.accumulo.core.client.A
 import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
 
 public interface Authenticator {
-  public AuthenticationToken login(Properties properties) throws AccumuloSecurityException;
+  public AuthenticationToken login(String principal, Properties properties) throws AccumuloSecurityException;
   
   public List<Set<AuthProperty>> getProperties();
   

Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/security/handler/InsecureAuthenticator.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/security/handler/InsecureAuthenticator.java?rev=1461330&r1=1461329&r2=1461330&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/security/handler/InsecureAuthenticator.java
(original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/security/handler/InsecureAuthenticator.java
Tue Mar 26 21:51:55 2013
@@ -33,7 +33,7 @@ public class InsecureAuthenticator imple
   static NullToken nt = new NullToken();
   
   @Override
-  public AuthenticationToken login(Properties properties) throws AccumuloSecurityException
{
+  public AuthenticationToken login(String principal, Properties properties) throws AccumuloSecurityException
{
     return nt;
   }
   

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=1461330&r1=1461329&r2=1461330&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
Tue Mar 26 21:51:55 2013
@@ -35,11 +35,11 @@ public class ZKAuthenticator implements 
   Logger log = Logger.getLogger(ZKAuthenticator.class);
   
   @Override
-  public AuthenticationToken login(Properties properties) throws AccumuloSecurityException
{
+  public AuthenticationToken login(String principal, Properties properties) throws AccumuloSecurityException
{
     if (properties.containsKey("password"))
       return new PasswordToken(properties.getProperty("password"));
     
-    throw new AccumuloSecurityException(properties.getProperty("principal"), SecurityErrorCode.INSUFFICIENT_PROPERTIES);
+    throw new AccumuloSecurityException(principal, SecurityErrorCode.INSUFFICIENT_PROPERTIES);
   }
 
   @Override
@@ -47,7 +47,6 @@ public class ZKAuthenticator implements 
     List<Set<AuthProperty>> toRet = new LinkedList<Set<AuthProperty>>();
     Set<AuthProperty> internal = new LinkedHashSet<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/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java?rev=1461330&r1=1461329&r2=1461330&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
(original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
Tue Mar 26 21:51:55 2013
@@ -265,7 +265,7 @@ public class Shell extends ShellOptions 
             String[] split = lo.split("=");
             props.put(split[0], split[1]);
           }
-        this.token = instance.getAuthenticator().login(props);
+        this.token = instance.getAuthenticator().login(principal, props);
       }
 
       if (!cl.hasOption(fakeOption.getLongOpt())) {
@@ -306,7 +306,7 @@ public class Shell extends ShellOptions 
             value = reader.readLine("Enter " + prop + ": ");
           props.setProperty(prop.getKey(), value);
         }
-        this.token = instance.getAuthenticator().login(props);
+        this.token = instance.getAuthenticator().login(principal, props);
       }
       if (this.token == null) {
         reader.printNewline();

Modified: accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java?rev=1461330&r1=1461329&r2=1461330&view=diff
==============================================================================
--- accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java (original)
+++ accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java Tue
Mar 26 21:51:55 2013
@@ -607,9 +607,9 @@ public class ProxyServer implements Accu
   }
   
   @Override
-  public boolean authenticateUser(ByteBuffer login, String user, Map<String, String>
properties) throws TException {
+  public boolean authenticateUser(ByteBuffer login, String principal, Map<String, String>
properties) throws TException {
     try {
-      return getConnector(login).securityOperations().authenticateUser(user, getToken(properties));
+      return getConnector(login).securityOperations().authenticateUser(principal, getToken(principal,
properties));
     } catch (Exception e) {
       throw translateException(e);
     }
@@ -1191,7 +1191,7 @@ public class ProxyServer implements Accu
   @Override
   public ByteBuffer login(String principal, Map<String,String> loginProperties) throws
TException {
     try {
-      AuthenticationToken token = getToken(loginProperties);
+      AuthenticationToken token = getToken(principal, loginProperties);
       TCredentials credential = CredentialHelper.create(principal, token, instance.getInstanceID());
       return ByteBuffer.wrap(CredentialHelper.asByteArray(credential));
     } catch (Exception e) {
@@ -1199,9 +1199,9 @@ public class ProxyServer implements Accu
     }
   }
   
-  private AuthenticationToken getToken(Map<String, String> properties) throws AccumuloSecurityException,
AccumuloException {
+  private AuthenticationToken getToken(String principal, Map<String, String> properties)
throws AccumuloSecurityException, AccumuloException {
     Properties props = new Properties();
     props.putAll(properties);
-    return instance.getAuthenticator().login(props);
+    return instance.getAuthenticator().login(principal, props);
   }
 }

Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java?rev=1461330&r1=1461329&r2=1461330&view=diff
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
(original)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
Tue Mar 26 21:51:55 2013
@@ -233,7 +233,7 @@ public class HdfsZooInstance implements 
   
   public Connector getConnector(String principal, Properties props) throws AccumuloException,
AccumuloSecurityException {
     Authenticator authenticator = getAuthenticator();
-    AuthenticationToken authToken = authenticator.login(props);
+    AuthenticationToken authToken = authenticator.login(principal, props);
     return getConnector(principal, authToken);
   }
 }

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=1461330&r1=1461329&r2=1461330&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
Tue Mar 26 21:51:55 2013
@@ -83,7 +83,7 @@ abstract class Basic extends BasicServle
       }
       if (!props.containsKey("principal"))
         props.put("principal", principal);
-      at = HdfsZooInstance.getInstance().getAuthenticator().login(props);
+      at = HdfsZooInstance.getInstance().getAuthenticator().login(principal, props);
     }
     
     String table = conf.get(Property.TRACE_TABLE);

Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java?rev=1461330&r1=1461329&r2=1461330&view=diff
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
(original)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
Tue Mar 26 21:51:55 2013
@@ -174,9 +174,7 @@ public class TraceServer implements Watc
           for (Entry<String, String> entry : loginMap.entrySet()) {
             props.put(entry.getKey().substring(prefixLength), entry.getValue());
           }
-          if (!props.containsKey("principal"))
-            props.put("principal", principal);
-          at = serverConfiguration.getInstance().getAuthenticator().login(props);
+          at = serverConfiguration.getInstance().getAuthenticator().login(principal, props);
         }
         
         connector = serverConfiguration.getInstance().getConnector(principal, at);

Modified: accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java?rev=1461330&r1=1461329&r2=1461330&view=diff
==============================================================================
--- accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java
(original)
+++ accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java
Tue Mar 26 21:51:55 2013
@@ -400,10 +400,10 @@ public class WalkingSecurity extends Sec
   }
   
   @Override
-  public AuthenticationToken login(Properties properties) throws AccumuloSecurityException
{
+  public AuthenticationToken login(String principal, 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(principal, SecurityErrorCode.INSUFFICIENT_PROPERTIES);
   }
   
   @Override



Mime
View raw message