accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1423519 - in /accumulo/trunk/core: ./ src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
Date Tue, 18 Dec 2012 16:25:24 GMT
Author: vines
Date: Tue Dec 18 16:25:24 2012
New Revision: 1423519

URL: http://svn.apache.org/viewvc?rev=1423519&view=rev
Log:
Accumulo-912 - Merging to trunk


Modified:
    accumulo/trunk/core/   (props changed)
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java

Propchange: accumulo/trunk/core/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.4/src/core:r1423518

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=1423519&r1=1423518&r2=1423519&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
Tue Dec 18 16:25:24 2012
@@ -18,6 +18,7 @@ package org.apache.accumulo.core.client.
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -30,6 +31,7 @@ import org.apache.accumulo.core.client.I
 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;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.core.util.TextUtil;
@@ -103,7 +105,10 @@ public class MockInstance implements Ins
   @Override
   public Connector getConnector(String user, byte[] pass) throws AccumuloException, AccumuloSecurityException
{
     Connector conn = new MockConnector(user, acu, this);
-    conn.securityOperations().createUser(user, pass, new Authorizations());
+    if (!acu.users.containsKey(user))
+      conn.securityOperations().createUser(user, pass, new Authorizations());
+    else if (!Arrays.equals(acu.users.get(user).password, pass))
+        throw new AccumuloSecurityException(user, SecurityErrorCode.BAD_CREDENTIALS);
     return conn;
   }
   



Mime
View raw message