accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1427994 - in /accumulo/trunk: core/src/main/java/org/apache/accumulo/core/client/admin/ core/src/main/java/org/apache/accumulo/core/client/mock/ core/src/main/java/org/apache/accumulo/core/util/shell/commands/ core/src/test/java/org/apache...
Date Wed, 02 Jan 2013 20:21:27 GMT
Author: vines
Date: Wed Jan  2 20:21:26 2013
New Revision: 1427994

URL: http://svn.apache.org/viewvc?rev=1427994&view=rev
Log:
ACCUMULO-677 - deprecated createUser(user,pass,auths). Still uses same code base for thrift,
which uses an empty Authorizations


Modified:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperations.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperationsImpl.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockSecurityOperations.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/PermissionsTest.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/CreateUser.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/CreateUser.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MiniAccumuloClusterTest.java

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperations.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperations.java?rev=1427994&r1=1427993&r2=1427994&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperations.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperations.java
Wed Jan  2 20:21:26 2013
@@ -44,8 +44,23 @@ public interface SecurityOperations {
    *           if a general error occurs
    * @throws AccumuloSecurityException
    *           if the user does not have permission to create a user
+   * @deprecated Use {@link #createUser(String,byte[])} instead
    */
   public void createUser(String user, byte[] password, Authorizations authorizations) throws
AccumuloException, AccumuloSecurityException;
+
+  /**
+   * Create a user
+   * 
+   * @param user
+   *          the name of the user to create
+   * @param password
+   *          the plaintext password for the user
+   * @throws AccumuloException
+   *           if a general error occurs
+   * @throws AccumuloSecurityException
+   *           if the user does not have permission to create a user
+   */
+  public void createUser(String user, byte[] password) throws AccumuloException, AccumuloSecurityException;
   
   /**
    * Delete a user

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperationsImpl.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperationsImpl.java?rev=1427994&r1=1427993&r2=1427994&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperationsImpl.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperationsImpl.java
Wed Jan  2 20:21:26 2013
@@ -105,6 +105,7 @@ public class SecurityOperationsImpl impl
    *           if a general error occurs
    * @throws AccumuloSecurityException
    *           if the user does not have permission to create a user
+   * @deprecated Use {@link #createUser(String,byte[])} instead
    */
   public void createUser(final String user, final byte[] password, final Authorizations authorizations)
throws AccumuloException, AccumuloSecurityException {
     ArgumentChecker.notNull(user, password, authorizations);
@@ -115,6 +116,22 @@ public class SecurityOperationsImpl impl
       }
     });
   }
+
+  /**
+   * Create a user
+   * 
+   * @param user
+   *          the name of the user to create
+   * @param password
+   *          the plaintext password for the user
+   * @throws AccumuloException
+   *           if a general error occurs
+   * @throws AccumuloSecurityException
+   *           if the user does not have permission to create a user
+   */
+  public void createUser(final String user, final byte[] password) throws AccumuloException,
AccumuloSecurityException {
+    createUser(user, password, new Authorizations());
+  }
   
   /**
    * Delete a user

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java?rev=1427994&r1=1427993&r2=1427994&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
Wed Jan  2 20:21:26 2013
@@ -29,7 +29,6 @@ import org.apache.accumulo.core.client.A
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.thrift.AuthInfo;
 import org.apache.accumulo.core.security.thrift.SecurityErrorCode;
 import org.apache.accumulo.core.util.ByteBufferUtil;
@@ -106,7 +105,7 @@ public class MockInstance implements Ins
   public Connector getConnector(String user, byte[] pass) throws AccumuloException, AccumuloSecurityException
{
     Connector conn = new MockConnector(user, acu, this);
     if (!acu.users.containsKey(user))
-      conn.securityOperations().createUser(user, pass, new Authorizations());
+      conn.securityOperations().createUser(user, pass);
     else if (!Arrays.equals(acu.users.get(user).password, pass))
         throw new AccumuloSecurityException(user, SecurityErrorCode.BAD_CREDENTIALS);
     return conn;

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockSecurityOperations.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockSecurityOperations.java?rev=1427994&r1=1427993&r2=1427994&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockSecurityOperations.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockSecurityOperations.java
Wed Jan  2 20:21:26 2013
@@ -36,10 +36,18 @@ public class MockSecurityOperations impl
     this.acu = acu;
   }
   
+  /**
+   * @deprecated Use {@link #createUser(String,byte[])} instead
+   */
   @Override
   public void createUser(String user, byte[] password, Authorizations authorizations) throws
AccumuloException, AccumuloSecurityException {
     this.acu.users.put(user, new MockUser(user, password, authorizations));
   }
+
+  @Override
+  public void createUser(String user, byte[] password) throws AccumuloException, AccumuloSecurityException
{
+    createUser(user, password, new Authorizations());
+  }
   
   @Override
   public void dropUser(String user) throws AccumuloException, AccumuloSecurityException {

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java?rev=1427994&r1=1427993&r2=1427994&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java
Wed Jan  2 20:21:26 2013
@@ -60,7 +60,7 @@ public class CreateUserCommand extends C
       throw new IllegalArgumentException("Passwords do not match");
     }
     final Authorizations authorizations = parseAuthorizations(cl.hasOption(scanOptAuths.getOpt())
? cl.getOptionValue(scanOptAuths.getOpt()) : "");
-    shellState.getConnector().securityOperations().createUser(user, password.getBytes(),
authorizations);
+    shellState.getConnector().securityOperations().createUser(user, password.getBytes());
     Shell.log.debug("Created user " + user + " with" + (authorizations.isEmpty() ? " no"
: "") + " initial scan authorizations"
         + (!authorizations.isEmpty() ? " " + authorizations : ""));
     return 0;

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java?rev=1427994&r1=1427993&r2=1427994&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
(original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
Wed Jan  2 20:21:26 2013
@@ -83,7 +83,7 @@ public class MockConnectorTest {
   @Test
   public void testChangeAuths() throws Exception {
     Connector c = new MockConnector("root", new MockInstance());
-    c.securityOperations().createUser("greg", new byte[] {}, new Authorizations("A", "B",
"C"));
+    c.securityOperations().createUser("greg", new byte[] {});
     assertTrue(c.securityOperations().getUserAuthorizations("greg").contains("A".getBytes()));
     c.securityOperations().changeUserAuthorizations("greg", new Authorizations("X", "Y",
"Z"));
     assertTrue(c.securityOperations().getUserAuthorizations("greg").contains("X".getBytes()));

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/PermissionsTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/PermissionsTest.java?rev=1427994&r1=1427993&r2=1427994&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/PermissionsTest.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/PermissionsTest.java
Wed Jan  2 20:21:26 2013
@@ -76,7 +76,7 @@ public class PermissionsTest {
       verifyHasOnlyTheseSystemPermissions(getConnector(), getConnector().whoami(), SystemPermission.values());
       
       // create the test user
-      getConnector().securityOperations().createUser(TEST_USER, TEST_PASS.getBytes(), Constants.NO_AUTHS);
+      getConnector().securityOperations().createUser(TEST_USER, TEST_PASS.getBytes());
       Connector test_user_conn = getInstance().getConnector(TEST_USER, TEST_PASS.getBytes());
       verifyHasNoSystemPermissions(getConnector(), TEST_USER, SystemPermission.values());
       
@@ -168,7 +168,7 @@ public class PermissionsTest {
         case CREATE_USER:
           user = "__CREATE_USER_WITHOUT_PERM_TEST__";
           try {
-            test_user_conn.securityOperations().createUser(user, password.getBytes(), Constants.NO_AUTHS);
+            test_user_conn.securityOperations().createUser(user, password.getBytes());
             throw new IllegalStateException("Should NOT be able to create a user");
           } catch (AccumuloSecurityException e) {
             if (e.getErrorCode() != SecurityErrorCode.PERMISSION_DENIED || root_conn.securityOperations().authenticateUser(user,
password.getBytes()))
@@ -177,7 +177,7 @@ public class PermissionsTest {
           break;
         case DROP_USER:
           user = "__DROP_USER_WITHOUT_PERM_TEST__";
-          root_conn.securityOperations().createUser(user, password.getBytes(), Constants.NO_AUTHS);
+          root_conn.securityOperations().createUser(user, password.getBytes());
           try {
             test_user_conn.securityOperations().dropUser(user);
             throw new IllegalStateException("Should NOT be able to delete a user");
@@ -188,7 +188,7 @@ public class PermissionsTest {
           break;
         case ALTER_USER:
           user = "__ALTER_USER_WITHOUT_PERM_TEST__";
-          root_conn.securityOperations().createUser(user, password.getBytes(), Constants.NO_AUTHS);
+          root_conn.securityOperations().createUser(user, password.getBytes());
           try {
             test_user_conn.securityOperations().changeUserAuthorizations(user, new Authorizations("A",
"B"));
             throw new IllegalStateException("Should NOT be able to alter a user");
@@ -243,20 +243,20 @@ public class PermissionsTest {
           break;
         case CREATE_USER:
           user = "__CREATE_USER_WITH_PERM_TEST__";
-          test_user_conn.securityOperations().createUser(user, password.getBytes(), Constants.NO_AUTHS);
+          test_user_conn.securityOperations().createUser(user, password.getBytes());
           if (!root_conn.securityOperations().authenticateUser(user, password.getBytes()))
             throw new IllegalStateException("Should be able to create a user");
           break;
         case DROP_USER:
           user = "__DROP_USER_WITH_PERM_TEST__";
-          root_conn.securityOperations().createUser(user, password.getBytes(), Constants.NO_AUTHS);
+          root_conn.securityOperations().createUser(user, password.getBytes());
           test_user_conn.securityOperations().dropUser(user);
           if (root_conn.securityOperations().authenticateUser(user, password.getBytes()))
             throw new IllegalStateException("Should be able to delete a user");
           break;
         case ALTER_USER:
           user = "__ALTER_USER_WITH_PERM_TEST__";
-          root_conn.securityOperations().createUser(user, password.getBytes(), Constants.NO_AUTHS);
+          root_conn.securityOperations().createUser(user, password.getBytes());
           test_user_conn.securityOperations().changeUserAuthorizations(user, new Authorizations("A",
"B"));
           if (root_conn.securityOperations().getUserAuthorizations(user).isEmpty())
             throw new IllegalStateException("Should be able to alter a user");
@@ -313,7 +313,7 @@ public class PermissionsTest {
     @Override
     public void run() throws AccumuloException, AccumuloSecurityException, TableExistsException,
TableNotFoundException, MutationsRejectedException {
       // create the test user
-      getConnector().securityOperations().createUser(TEST_USER, TEST_PASS.getBytes(), Constants.NO_AUTHS);
+      getConnector().securityOperations().createUser(TEST_USER, TEST_PASS.getBytes());
       Connector test_user_conn = getInstance().getConnector(TEST_USER, TEST_PASS.getBytes());
       
       // check for read-only access to metadata table

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/CreateUser.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/CreateUser.java?rev=1427994&r1=1427993&r2=1427994&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/CreateUser.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/CreateUser.java
Wed Jan  2 20:21:26 2013
@@ -20,7 +20,6 @@ import java.util.List;
 import java.util.Properties;
 import java.util.Random;
 
-import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.server.test.randomwalk.State;
@@ -40,7 +39,7 @@ public class CreateUser extends Test {
     
     try {
       log.debug("Creating user " + userName);
-      conn.securityOperations().createUser(userName, (userName + "pass").getBytes(), Constants.NO_AUTHS);
+      conn.securityOperations().createUser(userName, (userName + "pass").getBytes());
     } catch (AccumuloSecurityException ex) {
       log.debug("Create user failed " + ex.getCause());
     }

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/CreateUser.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/CreateUser.java?rev=1427994&r1=1427993&r2=1427994&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/CreateUser.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/CreateUser.java
Wed Jan  2 20:21:26 2013
@@ -21,7 +21,6 @@ import java.util.Properties;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.SystemPermission;
 import org.apache.accumulo.server.test.randomwalk.State;
 import org.apache.accumulo.server.test.randomwalk.Test;
@@ -40,7 +39,7 @@ public class CreateUser extends Test {
       hasPermission = true;
     byte[] tabUserPass = "Super Sekret Table User Password".getBytes();
     try {
-      conn.securityOperations().createUser(tableUserName, tabUserPass, new Authorizations());
+      conn.securityOperations().createUser(tableUserName, tabUserPass);
     } catch (AccumuloSecurityException ae) {
       switch (ae.getErrorCode()) {
         case PERMISSION_DENIED:
@@ -50,7 +49,7 @@ public class CreateUser extends Test {
           // create user anyway for sake of state
           {
             if (!exists) {
-              state.getConnector().securityOperations().createUser(tableUserName, tabUserPass,
new Authorizations());
+              state.getConnector().securityOperations().createUser(tableUserName, tabUserPass);
               SecurityHelper.setTabUserPass(state, tabUserPass);
               SecurityHelper.setTabUserExists(state, true);
             }

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java?rev=1427994&r1=1427993&r2=1427994&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/SecurityFixture.java
Wed Jan  2 20:21:26 2013
@@ -44,7 +44,7 @@ public class SecurityFixture extends Fix
     secTableName = String.format("security_%s_%s_%d", hostname, state.getPid(), System.currentTimeMillis());
     
     byte[] sysUserPass = "sysUser".getBytes();
-    conn.securityOperations().createUser(systemUserName, sysUserPass, new Authorizations());
+    conn.securityOperations().createUser(systemUserName, sysUserPass);
     sysConn = instance.getConnector(systemUserName, sysUserPass);
     
     SecurityHelper.setSystemConnector(state, sysConn);

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MiniAccumuloClusterTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MiniAccumuloClusterTest.java?rev=1427994&r1=1427993&r2=1427994&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MiniAccumuloClusterTest.java
(original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MiniAccumuloClusterTest.java
Wed Jan  2 20:21:26 2013
@@ -65,7 +65,7 @@ public class MiniAccumuloClusterTest {
     
     conn.tableOperations().create("table1");
     
-    conn.securityOperations().createUser("user1", "pass1".getBytes(), new Authorizations("A",
"B"));
+    conn.securityOperations().createUser("user1", "pass1".getBytes());
     conn.securityOperations().grantTablePermission("user1", "table1", TablePermission.WRITE);
     conn.securityOperations().grantTablePermission("user1", "table1", TablePermission.READ);
     



Mime
View raw message