You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by vi...@apache.org on 2013/02/04 19:09:41 UTC
svn commit: r1442284 [1/14] - in /accumulo/trunk: core/
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/admin/
core/src/main/java/org/apache/accumul...
Author: vines
Date: Mon Feb 4 18:09:38 2013
New Revision: 1442284
URL: http://svn.apache.org/viewvc?rev=1442284&view=rev
Log:
ACCUMULO-259 ACCUMULO-996 ACCUMULO-1003 ACCUMULO-1025 ACCUMULO-1027 ACCUMULO-1028 - reverting client side back to non-descript Principal/token fields. No more
SecuritySerDe, no more AccumuloToken, non-deprecated AuthInfo, no more Thrift based tokens, segregated principal/token
Removed:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftInstanceTokenWrapper.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftKerberosToken.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/ThriftUserPassToken.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/tokens/
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/UserPass.java
Modified:
accumulo/trunk/core/ (props changed)
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnDefaultTable.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnRequiredTable.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/Instance.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
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/admin/TableOperationsImpl.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/BatchWriterImpl.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchDeleter.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReader.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/thrift/ClientService.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormat.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormat.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapred/InputFormatBase.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormat.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormat.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/ConfiguratorBase.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/InputConfigurator.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/gc/thrift/GCMonitorService.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/master/thrift/MasterClientService.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/thrift/AuthInfo.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/tabletserver/thrift/TabletClientService.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/MetadataTable.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/AuthenticateCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateUserCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java
accumulo/trunk/core/src/main/thrift/client.thrift
accumulo/trunk/core/src/main/thrift/gc.thrift
accumulo/trunk/core/src/main/thrift/master.thrift
accumulo/trunk/core/src/main/thrift/security.thrift
accumulo/trunk/core/src/main/thrift/tabletserver.thrift
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/admin/FindMaxTest.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/mock/TestBatchScanner821.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
accumulo/trunk/examples/ (props changed)
accumulo/trunk/examples/instamo/src/main/java/org/apache/accumulo/instamo/AccumuloApp.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchScanner.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/ReadWriteExample.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/dirlist/Viewer.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/FileDataIngest.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/FileDataQuery.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/ContinuousQuery.java
accumulo/trunk/examples/simple/src/test/java/org/apache/accumulo/examples/simple/dirlist/CountTest.java
accumulo/trunk/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputFormatTest.java
accumulo/trunk/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputStreamTest.java
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/ActiveScan.java
accumulo/trunk/proxy/src/main/thrift/proxy.thrift
accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java
accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java
accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/balancer/TabletBalancer.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataStateStore.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/state/RootTabletStateStore.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/metanalysis/IndexMeta.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/TServersServlet.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/SecurityConstants.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/handler/Authenticator.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/handler/Authorizor.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/handler/InsecureAuthenticator.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/handler/InsecurePermHandler.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/handler/PermissionHandler.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthenticator.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/mastermessage/MasterMessage.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/mastermessage/SplitReportMessage.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/mastermessage/TabletStatusMessage.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Admin.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/CheckForMetadataProblems.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java
accumulo/trunk/server/src/test/java/org/apache/accumulo/server/gc/TestConfirmDeletes.java
accumulo/trunk/server/src/test/java/org/apache/accumulo/server/master/TestMergeState.java
accumulo/trunk/server/src/test/java/org/apache/accumulo/server/master/balancer/TableLoadBalancerTest.java
accumulo/trunk/server/src/test/java/org/apache/accumulo/server/util/CloneTest.java
accumulo/trunk/server/src/test/java/org/apache/accumulo/server/util/TabletIteratorTest.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/GetMasterStats.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/WrongTabletTest.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTest.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/PermissionsTest.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/ZombieTServer.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/State.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateUser.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/multitable/CopyTool.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTable.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Authenticate.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/CreateTable.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/CreateUser.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropUser.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SecurityFixture.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SetAuths.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/TableOp.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Validate.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/MapRedVerifyTool.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/scalability/ScaleTest.java
accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MiniAccumuloClusterTest.java
accumulo/trunk/test/src/test/java/org/apache/accumulo/test/iterator/RegExTest.java
Propchange: accumulo/trunk/core/
------------------------------------------------------------------------------
Reverse-merged /accumulo/branches/ACCUMULO-259/core:r1343822-1438343
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnDefaultTable.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnDefaultTable.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnDefaultTable.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnDefaultTable.java Mon Feb 4 18:09:38 2013
@@ -16,7 +16,6 @@
*/
package org.apache.accumulo.core.cli;
-import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat;
import org.apache.accumulo.core.client.mapreduce.AccumuloOutputFormat;
import org.apache.hadoop.mapreduce.Job;
@@ -40,12 +39,12 @@ public class ClientOnDefaultTable extend
}
@Override
- public void setAccumuloConfigs(Job job) throws AccumuloSecurityException {
+ public void setAccumuloConfigs(Job job) {
super.setAccumuloConfigs(job);
- AccumuloInputFormat.setConnectorInfo(job, getAccumuloToken());
+ AccumuloInputFormat.setConnectorInfo(job, user, getPassword());
AccumuloInputFormat.setInputTableName(job, getTableName());
AccumuloInputFormat.setScanAuthorizations(job, auths);
- AccumuloOutputFormat.setConnectorInfo(job, getAccumuloToken());
+ AccumuloOutputFormat.setConnectorInfo(job, user, getPassword());
AccumuloOutputFormat.setCreateTables(job, true);
AccumuloOutputFormat.setDefaultTableName(job, getTableName());
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnRequiredTable.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnRequiredTable.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnRequiredTable.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnRequiredTable.java Mon Feb 4 18:09:38 2013
@@ -16,7 +16,6 @@
*/
package org.apache.accumulo.core.cli;
-import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat;
import org.apache.accumulo.core.client.mapreduce.AccumuloOutputFormat;
import org.apache.hadoop.mapreduce.Job;
@@ -29,12 +28,12 @@ public class ClientOnRequiredTable exten
public String tableName = null;
@Override
- public void setAccumuloConfigs(Job job) throws AccumuloSecurityException {
+ public void setAccumuloConfigs(Job job) {
super.setAccumuloConfigs(job);
- AccumuloInputFormat.setConnectorInfo(job, getAccumuloToken());
+ AccumuloInputFormat.setConnectorInfo(job, user, getPassword());
AccumuloInputFormat.setInputTableName(job, tableName);
AccumuloInputFormat.setScanAuthorizations(job, auths);
- AccumuloOutputFormat.setConnectorInfo(job, getAccumuloToken());
+ AccumuloOutputFormat.setConnectorInfo(job, user, getPassword());
AccumuloOutputFormat.setCreateTables(job, true);
AccumuloOutputFormat.setDefaultTableName(job, tableName);
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java Mon Feb 4 18:09:38 2013
@@ -16,6 +16,7 @@
*/
package org.apache.accumulo.core.cli;
+import java.nio.ByteBuffer;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.TreeMap;
@@ -36,9 +37,7 @@ import org.apache.accumulo.core.conf.Def
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.ColumnVisibility;
-import org.apache.accumulo.core.security.tokens.SecurityToken;
-import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
-import org.apache.accumulo.core.security.tokens.UserPassToken;
+import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapreduce.Job;
@@ -78,6 +77,7 @@ public class ClientOpts extends Help {
value = dfault.getBytes();
}
+ @Override
public String toString() {
return new String(value);
}
@@ -106,26 +106,11 @@ public class ClientOpts extends Help {
@Parameter(names = "--password", converter = PasswordConverter.class, description = "Enter the connection password", password = true)
public Password securePassword = null;
- public SecurityToken getAccumuloToken() {
- try {
- String tokenClass = getInstance().getSecurityTokenClass();
- if (tokenClass.equals(UserPassToken.class.getCanonicalName())) {
- if (securePassword == null) {
- return new UserPassToken(user, password.value);
- }
- return new UserPassToken(user, securePassword.value);
-// } else if (tokenClass.equals(KerberosToken.class.getCanonicalName())) {
-// if (securePassword == null) {
-// return new KerberosToken(user, password.toString().toCharArray(), "accumulo");
-// }
-// return new KerberosToken(user, securePassword.toString().toCharArray(), "accumulo");
- } else
- throw new RuntimeException("CLI can't handle alternative tokens... yet");
- } catch (AccumuloException e) {
- throw new RuntimeException(e);
-// } catch (GeneralSecurityException e) {
-// throw new RuntimeException(e);
+ public byte[] getPassword() {
+ if (securePassword == null) {
+ return password.value;
}
+ return securePassword.value;
}
@Parameter(names = {"-z", "--keepers"}, description = "Comma separated list of zookeeper hosts (host:port,host:port)")
@@ -212,14 +197,14 @@ public class ClientOpts extends Help {
}
public Connector getConnector() throws AccumuloException, AccumuloSecurityException {
- return getInstance().getConnector(this.getAccumuloToken());
+ return getInstance().getConnector(this.user, this.getPassword());
}
- public InstanceTokenWrapper getWrappedToken() {
- return new InstanceTokenWrapper(getAccumuloToken(), getInstance().getInstanceID());
+ public Credentials getCredentials() {
+ return new Credentials(user, ByteBuffer.wrap(getPassword()), getInstance().getInstanceID());
}
- public void setAccumuloConfigs(Job job) throws AccumuloSecurityException {
+ public void setAccumuloConfigs(Job job) {
AccumuloInputFormat.setZooKeeperInstance(job, instance, zookeepers);
AccumuloOutputFormat.setZooKeeperInstance(job, instance, zookeepers);
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/Instance.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/Instance.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/Instance.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/Instance.java Mon Feb 4 18:09:38 2013
@@ -20,15 +20,12 @@ import java.nio.ByteBuffer;
import java.util.List;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.security.thrift.AuthInfo;
-import org.apache.accumulo.core.security.tokens.SecurityToken;
-import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
+import org.apache.accumulo.core.security.thrift.Credentials;
/**
* This class represents the information a client needs to know to connect to an instance of accumulo.
*
*/
-@SuppressWarnings("deprecation")
public interface Instance {
/**
* Returns the location of the tablet server that is serving the root tablet.
@@ -91,41 +88,14 @@ public interface Instance {
* Returns a connection to accumulo.
*
* @param auth
- * An AuthInfo object.
+ * An Credentials object.
* @return the accumulo Connector
* @throws AccumuloException
* when a generic exception occurs
* @throws AccumuloSecurityException
* when a user's credentials are invalid
- * @deprecated @since 1.5, use {@link #getConnector(SecurityToken)}
*/
- public abstract Connector getConnector(AuthInfo auth) throws AccumuloException, AccumuloSecurityException;
-
- /**
- * Returns a connection to accumulo.
- *
- * @param token
- * An AccumuloToken implementing object.
- * @return the accumulo Connector
- * @throws AccumuloException
- * when a generic exception occurs
- * @throws AccumuloSecurityException
- * when a user's credentials are invalid
- */
- public abstract Connector getConnector(SecurityToken token) throws AccumuloException, AccumuloSecurityException;
-
- /**
- * Returns a connection to accumulo.
- *
- * @param token
- * An InstanceTokenWrapper.
- * @return the accumulo Connector
- * @throws AccumuloException
- * when a generic exception occurs
- * @throws AccumuloSecurityException
- * when a user's credentials are invalid
- */
- public abstract Connector getConnector(InstanceTokenWrapper token) throws AccumuloException, AccumuloSecurityException;
+ public abstract Connector getConnector(Credentials auth) throws AccumuloException, AccumuloSecurityException;
/**
* Returns a connection to accumulo.
@@ -139,7 +109,6 @@ public interface Instance {
* when a generic exception occurs
* @throws AccumuloSecurityException
* when a user's credentials are invalid
- * @deprecated @since 1.5, use {@link #getConnector(SecurityToken)}
*/
public abstract Connector getConnector(String user, ByteBuffer pass) throws AccumuloException, AccumuloSecurityException;
@@ -155,7 +124,6 @@ public interface Instance {
* when a generic exception occurs
* @throws AccumuloSecurityException
* when a user's credentials are invalid
- * @deprecated @since 1.5, use {@link #getConnector(SecurityToken)}
*/
public abstract Connector getConnector(String user, CharSequence pass) throws AccumuloException, AccumuloSecurityException;
@@ -173,10 +141,10 @@ public interface Instance {
* accumulo configuration
*/
public abstract void setConfiguration(AccumuloConfiguration conf);
-
+
/**
- * Returns the class name for the tokens Accumulo is expecting.
- * @throws AccumuloException
+ * @return the canonical name of the helper class for the security token from the authenticator, if one exists.
+ * @throws AccumuloException
*/
- public abstract String getSecurityTokenClass() throws AccumuloException;
+ public abstract String getAuthenticatorClassName() throws AccumuloException;
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java Mon Feb 4 18:09:38 2013
@@ -29,12 +29,10 @@ import org.apache.accumulo.core.conf.Acc
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.file.FileUtil;
import org.apache.accumulo.core.master.thrift.MasterClientService.Client;
-import org.apache.accumulo.core.security.thrift.AuthInfo;
+import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
-import org.apache.accumulo.core.security.tokens.SecurityToken;
-import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
-import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.accumulo.core.util.ArgumentChecker;
+import org.apache.accumulo.core.util.ByteBufferUtil;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.accumulo.core.util.OpTimer;
import org.apache.accumulo.core.util.TextUtil;
@@ -64,7 +62,6 @@ import org.apache.thrift.transport.TTran
*
*/
-@SuppressWarnings("deprecation")
public class ZooKeeperInstance implements Instance {
private static final Logger log = Logger.getLogger(ZooKeeperInstance.class);
@@ -210,29 +207,21 @@ public class ZooKeeperInstance implement
return zooKeepersSessionTimeOut;
}
- /**
- * @deprecated @since 1.5, use {@link #getConnector(SecurityToken)}
- */
@Override
public Connector getConnector(String user, CharSequence pass) throws AccumuloException, AccumuloSecurityException {
return getConnector(user, TextUtil.getBytes(new Text(pass.toString())));
}
- /**
- * @deprecated @since 1.5, use {@link #getConnector(SecurityToken)}
- */
@Override
public Connector getConnector(String user, ByteBuffer pass) throws AccumuloException, AccumuloSecurityException {
- return getConnector(new UserPassToken(user, pass));
+ return getConnector(user, ByteBufferUtil.toBytes(pass));
}
// Suppress deprecation, ConnectorImpl is deprecated to warn clients against using.
- /**
- * @deprecated @since 1.5, use {@link #getConnector(SecurityToken)}
- */
+ @SuppressWarnings("deprecation")
@Override
public Connector getConnector(String user, byte[] pass) throws AccumuloException, AccumuloSecurityException {
- return getConnector(user, ByteBuffer.wrap(pass));
+ return new ConnectorImpl(this, user, pass);
}
private AccumuloConfiguration conf = null;
@@ -298,32 +287,17 @@ public class ZooKeeperInstance implement
}
}
- /**
- * @deprecated @since 1.5, use {@link #getConnector(SecurityToken)}
- */
@Override
- public Connector getConnector(AuthInfo auth) throws AccumuloException, AccumuloSecurityException {
- return getConnector(auth.user, auth.password);
+ public Connector getConnector(Credentials auth) throws AccumuloException, AccumuloSecurityException {
+ return getConnector(auth.getPrincipal(), auth.getToken());
}
- // Suppress deprecation, ConnectorImpl is deprecated to warn clients against using.
@Override
- public Connector getConnector(SecurityToken token) throws AccumuloException, AccumuloSecurityException {
- return new ConnectorImpl(this, token);
- }
-
- // Suppress deprecation, ConnectorImpl is deprecated to warn clients against using.
- @Override
- public Connector getConnector(InstanceTokenWrapper token) throws AccumuloException, AccumuloSecurityException {
- return getConnector(token.getToken());
- }
-
- @Override
- public String getSecurityTokenClass() throws AccumuloException {
+ public String getAuthenticatorClassName() throws AccumuloException {
Client client = null;
try {
client = MasterClient.getConnectionWithRetry(this);
- return client.getSecurityTokenClass();
+ return client.getAuthenticatorClassName();
} catch (TTransportException e) {
throw new AccumuloException(e);
} catch (ThriftSecurityException e) {
@@ -336,4 +310,5 @@ public class ZooKeeperInstance implement
}
}
}
+
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperationsImpl.java Mon Feb 4 18:09:38 2013
@@ -21,7 +21,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
-import org.apache.accumulo.trace.instrument.Tracer;
import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -34,13 +33,14 @@ import org.apache.accumulo.core.client.i
import org.apache.accumulo.core.client.impl.thrift.ClientService;
import org.apache.accumulo.core.client.impl.thrift.ConfigurationType;
import org.apache.accumulo.core.master.thrift.MasterClientService;
-import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
+import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Client;
import org.apache.accumulo.core.util.ArgumentChecker;
import org.apache.accumulo.core.util.ThriftUtil;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.fate.zookeeper.ZooCache;
+import org.apache.accumulo.trace.instrument.Tracer;
import org.apache.thrift.TException;
import org.apache.thrift.transport.TTransportException;
@@ -49,7 +49,7 @@ import org.apache.thrift.transport.TTran
*/
public class InstanceOperationsImpl implements InstanceOperations {
private Instance instance;
- private InstanceTokenWrapper credentials;
+ private Credentials credentials;
/**
* @param instance
@@ -57,34 +57,43 @@ public class InstanceOperationsImpl impl
* @param credentials
* the username/password for this connection
*/
- public InstanceOperationsImpl(Instance instance, InstanceTokenWrapper credentials) {
+ public InstanceOperationsImpl(Instance instance, Credentials credentials) {
ArgumentChecker.notNull(instance, credentials);
this.instance = instance;
this.credentials = credentials;
}
+ /* (non-Javadoc)
+ * @see org.apache.accumulo.core.client.admin.InstanceOperations#setProperty(java.lang.String, java.lang.String)
+ */
@Override
public void setProperty(final String property, final String value) throws AccumuloException, AccumuloSecurityException {
ArgumentChecker.notNull(property, value);
MasterClient.execute(instance, new ClientExec<MasterClientService.Client>() {
@Override
public void execute(MasterClientService.Client client) throws Exception {
- client.setSystemProperty(Tracer.traceInfo(), credentials.toThrift(), property, value);
+ client.setSystemProperty(Tracer.traceInfo(), credentials, property, value);
}
});
}
+ /* (non-Javadoc)
+ * @see org.apache.accumulo.core.client.admin.InstanceOperations#removeProperty(java.lang.String)
+ */
@Override
public void removeProperty(final String property) throws AccumuloException, AccumuloSecurityException {
ArgumentChecker.notNull(property);
MasterClient.execute(instance, new ClientExec<MasterClientService.Client>() {
@Override
public void execute(MasterClientService.Client client) throws Exception {
- client.removeSystemProperty(Tracer.traceInfo(), credentials.toThrift(), property);
+ client.removeSystemProperty(Tracer.traceInfo(), credentials, property);
}
});
}
+ /* (non-Javadoc)
+ * @see org.apache.accumulo.core.client.admin.InstanceOperations#getSystemConfiguration()
+ */
@Override
public Map<String,String> getSystemConfiguration() throws AccumuloException, AccumuloSecurityException {
return ServerClient.execute(instance, new ClientExecReturn<Map<String,String>,ClientService.Client>() {
@@ -95,6 +104,9 @@ public class InstanceOperationsImpl impl
});
}
+ /* (non-Javadoc)
+ * @see org.apache.accumulo.core.client.admin.InstanceOperations#getSiteConfiguration()
+ */
@Override
public Map<String,String> getSiteConfiguration() throws AccumuloException, AccumuloSecurityException {
return ServerClient.execute(instance, new ClientExecReturn<Map<String,String>,ClientService.Client>() {
@@ -105,6 +117,10 @@ public class InstanceOperationsImpl impl
});
}
+ /* (non-Javadoc)
+ * @see org.apache.accumulo.core.client.admin.InstanceOperations#getTabletServers()
+ */
+
@Override
public List<String> getTabletServers() {
ZooCache cache = ZooCache.getInstance(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
@@ -124,6 +140,10 @@ public class InstanceOperationsImpl impl
return results;
}
+ /* (non-Javadoc)
+ * @see org.apache.accumulo.core.client.admin.InstanceOperations#getActiveScans(java.lang.String)
+ */
+
@Override
public List<ActiveScan> getActiveScans(String tserver) throws AccumuloException, AccumuloSecurityException {
Client client = null;
@@ -131,7 +151,7 @@ public class InstanceOperationsImpl impl
client = ThriftUtil.getTServerClient(tserver, instance.getConfiguration());
List<ActiveScan> as = new ArrayList<ActiveScan>();
- for (org.apache.accumulo.core.tabletserver.thrift.ActiveScan activeScan : client.getActiveScans(Tracer.traceInfo(), credentials.toThrift())) {
+ for (org.apache.accumulo.core.tabletserver.thrift.ActiveScan activeScan : client.getActiveScans(Tracer.traceInfo(), credentials)) {
try {
as.add(new ActiveScan(instance, activeScan));
} catch (TableNotFoundException e) {
@@ -151,6 +171,9 @@ public class InstanceOperationsImpl impl
}
}
+ /* (non-Javadoc)
+ * @see org.apache.accumulo.core.client.admin.InstanceOperations#testClassLoad(java.lang.String, java.lang.String)
+ */
@Override
public boolean testClassLoad(final String className, final String asTypeName) throws AccumuloException, AccumuloSecurityException {
return ServerClient.execute(instance, new ClientExecReturn<Boolean,ClientService.Client>() {
@@ -161,6 +184,11 @@ public class InstanceOperationsImpl impl
});
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.accumulo.core.client.admin.InstanceOperations#getActiveCompactions(java.lang.String)
+ */
@Override
public List<ActiveCompaction> getActiveCompactions(String tserver) throws AccumuloException, AccumuloSecurityException {
Client client = null;
@@ -168,7 +196,7 @@ public class InstanceOperationsImpl impl
client = ThriftUtil.getTServerClient(tserver, instance.getConfiguration());
List<ActiveCompaction> as = new ArrayList<ActiveCompaction>();
- for (org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction activeCompaction : client.getActiveCompactions(Tracer.traceInfo(), credentials.toThrift())) {
+ for (org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction activeCompaction : client.getActiveCompactions(Tracer.traceInfo(), credentials)) {
as.add(new ActiveCompaction(instance, activeCompaction));
}
return as;
@@ -184,20 +212,23 @@ public class InstanceOperationsImpl impl
}
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.accumulo.core.client.admin.InstanceOperations#ping(java.lang.String)
+ */
@Override
public void ping(String tserver) throws AccumuloException {
Client client = null;
try {
client = ThriftUtil.getTServerClient(tserver, instance.getConfiguration());
- client.getTabletServerStatus(Tracer.traceInfo(), credentials.toThrift());
+ client.getTabletServerStatus(Tracer.traceInfo(), credentials);
} catch (TTransportException e) {
throw new AccumuloException(e);
} catch (ThriftSecurityException e) {
throw new AccumuloException(e);
} catch (TException e) {
throw new AccumuloException(e);
- } catch (AccumuloSecurityException e) {
- throw new AccumuloException(e);
} finally {
if (client != null) {
ThriftUtil.returnClient(client);
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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -23,7 +23,6 @@ import org.apache.accumulo.core.client.A
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.SystemPermission;
import org.apache.accumulo.core.security.TablePermission;
-import org.apache.accumulo.core.security.tokens.SecurityToken;
/**
* Provides a class for managing users and permissions
@@ -58,7 +57,7 @@ public interface SecurityOperations {
* @throws AccumuloSecurityException
* if the user does not have permission to create a user
*/
- public void createUser(SecurityToken token) throws AccumuloException, AccumuloSecurityException;
+ public void createUser(String user, byte[] password) throws AccumuloException, AccumuloSecurityException;
/**
* Delete a user
@@ -84,26 +83,10 @@ public interface SecurityOperations {
* if a general error occurs
* @throws AccumuloSecurityException
* if the user does not have permission to ask
- * @deprecated @since 1.5, use {@link #authenticateUser(SecurityToken)}
*/
- @Deprecated
public boolean authenticateUser(String user, byte[] password) throws AccumuloException, AccumuloSecurityException;
/**
- * Verify an AccumuloToken is valid
- *
- * @param token
- * the AccumuloToken to authenticate
- * @return true if the user asking is allowed to know and the specified user/password is valid, false otherwise
- * @throws AccumuloException
- * if a general error occurs
- * @throws AccumuloSecurityException
- * if the user does not have permission to ask
- * @since 1.5
- */
- public boolean authenticateUser(SecurityToken token) throws AccumuloException, AccumuloSecurityException;
-
- /**
* Set the user's password
*
* @param user
@@ -114,24 +97,10 @@ public interface SecurityOperations {
* if a general error occurs
* @throws AccumuloSecurityException
* if the user does not have permission to modify a user
- * @deprecated @since 1.5, use {@link #changeUserPassword(SecurityToken)}
*/
- @Deprecated
public void changeUserPassword(String user, byte[] password) throws AccumuloException, AccumuloSecurityException;
/**
- * Set the user's password
- *
- * @param newToken
- * the security token with the information about the user to modify
- * @throws AccumuloException
- * if a general error occurs
- * @throws AccumuloSecurityException
- * if the user does not have permission to modify a user
- */
- public void changeUserPassword(SecurityToken newToken) throws AccumuloException, AccumuloSecurityException;
-
- /**
* Set the user's record-level authorizations
*
* @param user
@@ -259,12 +228,5 @@ public interface SecurityOperations {
* @throws AccumuloSecurityException
* if the user does not have permission to query users
*/
- public Set<String> listUsers() throws AccumuloException, AccumuloSecurityException;
-
- /**
- * @deprecated @since 1.5, use {@link #createUser(SecurityToken)}
- */
- @Deprecated
- void createUser(SecurityToken token, Authorizations authorization) throws AccumuloException, AccumuloSecurityException;
-
+ public Set<String> listUsers() throws AccumuloException, AccumuloSecurityException;
}
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=1442284&r1=1442283&r2=1442284&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 Mon Feb 4 18:09:38 2013
@@ -16,6 +16,8 @@
*/
package org.apache.accumulo.core.client.admin;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
import java.util.Set;
import org.apache.accumulo.core.client.AccumuloException;
@@ -30,13 +32,9 @@ import org.apache.accumulo.core.client.i
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.SystemPermission;
import org.apache.accumulo.core.security.TablePermission;
+import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.accumulo.core.security.thrift.SecurityErrorCode;
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
-import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
-import org.apache.accumulo.core.security.tokens.PasswordUpdatable;
-import org.apache.accumulo.core.security.tokens.SecurityToken;
-import org.apache.accumulo.core.security.tokens.TokenHelper;
-import org.apache.accumulo.core.security.tokens.UserPassToken;
import org.apache.accumulo.core.util.ArgumentChecker;
import org.apache.accumulo.core.util.ByteBufferUtil;
import org.apache.accumulo.trace.instrument.Tracer;
@@ -44,7 +42,7 @@ import org.apache.accumulo.trace.instrum
public class SecurityOperationsImpl implements SecurityOperations {
private Instance instance;
- private InstanceTokenWrapper token;
+ private Credentials credentials;
private void execute(ClientExec<ClientService.Client> exec) throws AccumuloException, AccumuloSecurityException {
try {
@@ -88,10 +86,10 @@ public class SecurityOperationsImpl impl
* @param credentials
* the user credentials to use for security operations
*/
- public SecurityOperationsImpl(Instance instance, InstanceTokenWrapper credentials) {
+ public SecurityOperationsImpl(Instance instance, Credentials credentials) {
ArgumentChecker.notNull(instance, credentials);
this.instance = instance;
- this.token = credentials;
+ this.credentials = credentials;
}
/**
@@ -107,41 +105,20 @@ 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(SecurityToken)} instead
+ * @deprecated Use {@link #createUser(String,byte[])} instead
*/
@Override
@Deprecated
public void createUser(final String user, final byte[] password, final Authorizations authorizations) throws AccumuloException, AccumuloSecurityException {
ArgumentChecker.notNull(user, password, authorizations);
- createUser(new UserPassToken(user, password), authorizations);
- }
-
- /**
- * Create a user
- *
- * @param newToken
- * the security token with the information about the user to modify
- * @param authorizations
- * the authorizations that the user has for scanning
- * @throws AccumuloException
- * if a general error occurs
- * @throws AccumuloSecurityException
- * if the user does not have permission to create a user
- * @deprecated Use {@link #createUser(SecurityToken)} instead
- */
- @Deprecated
- @Override
- public void createUser(final SecurityToken newToken, final Authorizations authorizations) throws AccumuloException, AccumuloSecurityException {
- ArgumentChecker.notNull(newToken, authorizations);
execute(new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client client) throws Exception {
- client
- .createUser(Tracer.traceInfo(), token.toThrift(), TokenHelper.wrapper(newToken), ByteBufferUtil.toByteBuffers(authorizations.getAuthorizations()));
+ client.createUser(Tracer.traceInfo(), credentials, user, ByteBuffer.wrap(password), ByteBufferUtil.toByteBuffers(authorizations.getAuthorizations()));
}
});
}
-
+
/**
* Create a user
*
@@ -152,9 +129,8 @@ public class SecurityOperationsImpl impl
* @throws AccumuloSecurityException
* if the user does not have permission to create a user
*/
- @Override
- public void createUser(final SecurityToken newToken) throws AccumuloException, AccumuloSecurityException {
- createUser(newToken, new Authorizations());
+ public void createUser(final String user, final byte[] password) throws AccumuloException, AccumuloSecurityException {
+ createUser(user, password, new Authorizations());
}
/**
@@ -173,7 +149,7 @@ public class SecurityOperationsImpl impl
execute(new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client client) throws Exception {
- client.dropUser(Tracer.traceInfo(), token.toThrift(), user);
+ client.dropUser(Tracer.traceInfo(), credentials, user);
}
});
}
@@ -190,33 +166,15 @@ public class SecurityOperationsImpl impl
* if a general error occurs
* @throws AccumuloSecurityException
* if the user does not have permission to ask
- * @deprecated since 1.5, use {@link #authenticateUser(SecurityToken)}
*/
@Deprecated
@Override
public boolean authenticateUser(final String user, final byte[] password) throws AccumuloException, AccumuloSecurityException {
ArgumentChecker.notNull(user, password);
- return authenticateUser(new UserPassToken(user, password));
- }
-
- /**
- * Verify a username/password combination is valid
- *
- * @param token2
- * the AccumuloToken of the principal to authenticate
- * @return true if the user asking is allowed to know and the specified AccumuloToken is valid, false otherwise
- * @throws AccumuloException
- * if a general error occurs
- * @throws AccumuloSecurityException
- * if the user does not have permission to ask
- */
- @Override
- public boolean authenticateUser(final SecurityToken token2) throws AccumuloException, AccumuloSecurityException {
- ArgumentChecker.notNull(token2);
return execute(new ClientExecReturn<Boolean,ClientService.Client>() {
@Override
public Boolean execute(ClientService.Client client) throws Exception {
- return client.authenticateUser(Tracer.traceInfo(), token.toThrift(), TokenHelper.wrapper(token2));
+ return client.authenticateUser(Tracer.traceInfo(), credentials, user, ByteBuffer.wrap(password));
}
});
}
@@ -231,45 +189,20 @@ public class SecurityOperationsImpl impl
* @throws AccumuloSecurityException
* if the user does not have permission to modify a user
*/
- @Override
- public void changeUserPassword(final SecurityToken newToken) throws AccumuloException, AccumuloSecurityException {
- ArgumentChecker.notNull(newToken);
+ public void changeUserPassword(final String principal, final byte[] token) throws AccumuloException, AccumuloSecurityException {
+ ArgumentChecker.notNull(principal, token);
execute(new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client client) throws Exception {
- client.changePassword(Tracer.traceInfo(), token.toThrift(), TokenHelper.wrapper(newToken));
+ client.changePassword(Tracer.traceInfo(), credentials, principal, ByteBuffer.wrap(token));
}
});
- if (!(this.token.getToken() instanceof PasswordUpdatable) || !(newToken instanceof PasswordUpdatable))
- throw new AccumuloException("The AccumuloToken type cannot be dynamically adjusted. Please create a new token and reconnect");
- if (this.token.getPrincipal().equals(newToken.getPrincipal())) {
- PasswordUpdatable upt = (PasswordUpdatable) this.token.getToken();
- upt.updatePassword((PasswordUpdatable) newToken);
- token.toThrift().token = TokenHelper.wrapper(this.token.getToken());
+ if (this.credentials.principal.equals(principal)) {
+ this.credentials.token = ByteBuffer.wrap(Arrays.copyOf(token, token.length));
}
}
/**
- * Set the user's password
- *
- * @param user
- * the name of the user to modify
- * @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 modify a user
- * @deprecated since 1.5.0; use {@link #changeUserPassword(SecurityToken)} instead.
- */
- @Deprecated
- @Override
- public void changeUserPassword(final String user, final byte[] password) throws AccumuloException, AccumuloSecurityException {
- ArgumentChecker.notNull(user, password);
- changeUserPassword(new UserPassToken(user, password));
- }
-
- /**
* Set the user's record-level authorizations
*
* @param user
@@ -287,7 +220,7 @@ public class SecurityOperationsImpl impl
execute(new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client client) throws Exception {
- client.changeAuthorizations(Tracer.traceInfo(), token.toThrift(), user, ByteBufferUtil.toByteBuffers(authorizations.getAuthorizations()));
+ client.changeAuthorizations(Tracer.traceInfo(), credentials, user, ByteBufferUtil.toByteBuffers(authorizations.getAuthorizations()));
}
});
}
@@ -309,7 +242,7 @@ public class SecurityOperationsImpl impl
return execute(new ClientExecReturn<Authorizations,ClientService.Client>() {
@Override
public Authorizations execute(ClientService.Client client) throws Exception {
- return new Authorizations(client.getUserAuthorizations(Tracer.traceInfo(), token.toThrift(), user));
+ return new Authorizations(client.getUserAuthorizations(Tracer.traceInfo(), credentials, user));
}
});
}
@@ -333,7 +266,7 @@ public class SecurityOperationsImpl impl
return execute(new ClientExecReturn<Boolean,ClientService.Client>() {
@Override
public Boolean execute(ClientService.Client client) throws Exception {
- return client.hasSystemPermission(Tracer.traceInfo(), token.toThrift(), user, perm.getId());
+ return client.hasSystemPermission(Tracer.traceInfo(), credentials, user, perm.getId());
}
});
}
@@ -359,7 +292,7 @@ public class SecurityOperationsImpl impl
return execute(new ClientExecReturn<Boolean,ClientService.Client>() {
@Override
public Boolean execute(ClientService.Client client) throws Exception {
- return client.hasTablePermission(Tracer.traceInfo(), token.toThrift(), user, table, perm.getId());
+ return client.hasTablePermission(Tracer.traceInfo(), credentials, user, table, perm.getId());
}
});
}
@@ -382,7 +315,7 @@ public class SecurityOperationsImpl impl
execute(new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client client) throws Exception {
- client.grantSystemPermission(Tracer.traceInfo(), token.toThrift(), user, permission.getId());
+ client.grantSystemPermission(Tracer.traceInfo(), credentials, user, permission.getId());
}
});
}
@@ -407,7 +340,7 @@ public class SecurityOperationsImpl impl
execute(new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client client) throws Exception {
- client.grantTablePermission(Tracer.traceInfo(), token.toThrift(), user, table, permission.getId());
+ client.grantTablePermission(Tracer.traceInfo(), credentials, user, table, permission.getId());
}
});
}
@@ -430,7 +363,7 @@ public class SecurityOperationsImpl impl
execute(new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client client) throws Exception {
- client.revokeSystemPermission(Tracer.traceInfo(), token.toThrift(), user, permission.getId());
+ client.revokeSystemPermission(Tracer.traceInfo(), credentials, user, permission.getId());
}
});
}
@@ -456,7 +389,7 @@ public class SecurityOperationsImpl impl
execute(new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client client) throws Exception {
- client.revokeTablePermission(Tracer.traceInfo(), token.toThrift(), user, table, permission.getId());
+ client.revokeTablePermission(Tracer.traceInfo(), credentials, user, table, permission.getId());
}
});
}
@@ -475,7 +408,7 @@ public class SecurityOperationsImpl impl
return execute(new ClientExecReturn<Set<String>,ClientService.Client>() {
@Override
public Set<String> execute(ClientService.Client client) throws Exception {
- return client.listUsers(Tracer.traceInfo(), token.toThrift());
+ return client.listUsers(Tracer.traceInfo(), credentials);
}
});
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java Mon Feb 4 18:09:38 2013
@@ -74,8 +74,8 @@ import org.apache.accumulo.core.master.s
import org.apache.accumulo.core.master.thrift.MasterClientService;
import org.apache.accumulo.core.master.thrift.TableOperation;
import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
-import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
import org.apache.accumulo.core.util.ArgumentChecker;
@@ -105,9 +105,9 @@ import org.apache.thrift.transport.TTran
*/
public class TableOperationsImpl extends TableOperationsHelper {
private Instance instance;
- private InstanceTokenWrapper token;
+ private Credentials credentials;
- private static final Logger log = Logger.getLogger(TableOperationsImpl.class);
+ private static final Logger log = Logger.getLogger(TableOperations.class);
/**
* @param instance
@@ -115,10 +115,10 @@ public class TableOperationsImpl extends
* @param credentials
* the username/password for this connection
*/
- public TableOperationsImpl(Instance instance, InstanceTokenWrapper credentials) {
+ public TableOperationsImpl(Instance instance, Credentials credentials) {
ArgumentChecker.notNull(instance, credentials);
this.instance = instance;
- this.token = credentials;
+ this.credentials = credentials;
}
/**
@@ -210,12 +210,10 @@ public class TableOperationsImpl extends
MasterClientService.Iface client = null;
try {
client = MasterClient.getConnectionWithRetry(instance);
- return client.beginTableOperation(Tracer.traceInfo(), token.toThrift());
+ return client.beginTableOperation(Tracer.traceInfo(), credentials);
} catch (TTransportException tte) {
log.debug("Failed to call beginTableOperation(), retrying ... ", tte);
UtilWaitThread.sleep(100);
- } catch (AccumuloSecurityException e) {
- throw e.asThriftException();
} finally {
MasterClient.close(client);
}
@@ -228,13 +226,11 @@ public class TableOperationsImpl extends
MasterClientService.Iface client = null;
try {
client = MasterClient.getConnectionWithRetry(instance);
- client.executeTableOperation(Tracer.traceInfo(), token.toThrift(), opid, op, args, opts, autoCleanUp);
+ client.executeTableOperation(Tracer.traceInfo(), credentials, opid, op, args, opts, autoCleanUp);
break;
} catch (TTransportException tte) {
log.debug("Failed to call executeTableOperation(), retrying ... ", tte);
UtilWaitThread.sleep(100);
- } catch (AccumuloSecurityException e) {
- throw e.asThriftException();
} finally {
MasterClient.close(client);
}
@@ -246,12 +242,10 @@ public class TableOperationsImpl extends
MasterClientService.Iface client = null;
try {
client = MasterClient.getConnectionWithRetry(instance);
- return client.waitForTableOperation(Tracer.traceInfo(), token.toThrift(), opid);
+ return client.waitForTableOperation(Tracer.traceInfo(), credentials, opid);
} catch (TTransportException tte) {
log.debug("Failed to call waitForTableOperation(), retrying ... ", tte);
UtilWaitThread.sleep(100);
- } catch (AccumuloSecurityException e) {
- throw e.asThriftException();
} finally {
MasterClient.close(client);
}
@@ -263,13 +257,11 @@ public class TableOperationsImpl extends
MasterClientService.Iface client = null;
try {
client = MasterClient.getConnectionWithRetry(instance);
- client.finishTableOperation(Tracer.traceInfo(), token.toThrift(), opid);
+ client.finishTableOperation(Tracer.traceInfo(), credentials, opid);
break;
} catch (TTransportException tte) {
log.debug("Failed to call finishTableOperation(), retrying ... ", tte);
UtilWaitThread.sleep(100);
- } catch (AccumuloSecurityException e) {
- throw e.asThriftException();
} finally {
MasterClient.close(client);
}
@@ -431,7 +423,7 @@ public class TableOperationsImpl extends
private void addSplits(String tableName, SortedSet<Text> partitionKeys, String tableId) throws AccumuloException, AccumuloSecurityException,
TableNotFoundException, AccumuloServerException {
- TabletLocator tabLocator = TabletLocator.getInstance(instance, token, new Text(tableId));
+ TabletLocator tabLocator = TabletLocator.getInstance(instance, credentials, new Text(tableId));
for (Text split : partitionKeys) {
boolean successful = false;
@@ -461,7 +453,7 @@ public class TableOperationsImpl extends
if (log.isTraceEnabled())
opTimer = new OpTimer(log, Level.TRACE).start("Splitting tablet " + tl.tablet_extent + " on " + tl.tablet_location + " at " + split);
- client.splitTablet(Tracer.traceInfo(), token.toThrift(), tl.tablet_extent.toThrift(), TextUtil.getByteBuffer(split));
+ client.splitTablet(Tracer.traceInfo(), credentials, tl.tablet_extent.toThrift(), TextUtil.getByteBuffer(split));
// just split it, might as well invalidate it in the cache
tabLocator.invalidateCache(tl.tablet_extent);
@@ -548,7 +540,7 @@ public class TableOperationsImpl extends
try {
tablets.clear();
locations.clear();
- MetadataTable.getEntries(instance, token, tableName, false, locations, tablets);
+ MetadataTable.getEntries(instance, credentials, tableName, false, locations, tablets);
break;
} catch (Throwable t) {
log.info(t.getMessage() + " ... retrying ...");
@@ -769,7 +761,7 @@ public class TableOperationsImpl extends
MasterClientService.Iface client = null;
try {
client = MasterClient.getConnectionWithRetry(instance);
- flushID = client.initiateFlush(Tracer.traceInfo(), token.toThrift(), tableId);
+ flushID = client.initiateFlush(Tracer.traceInfo(), credentials, tableId);
break;
} catch (TTransportException tte) {
log.debug("Failed to call initiateFlush, retrying ... ", tte);
@@ -783,7 +775,7 @@ public class TableOperationsImpl extends
MasterClientService.Iface client = null;
try {
client = MasterClient.getConnectionWithRetry(instance);
- client.waitForFlush(Tracer.traceInfo(), token.toThrift(), tableId, TextUtil.getByteBuffer(start), TextUtil.getByteBuffer(end), flushID,
+ client.waitForFlush(Tracer.traceInfo(), credentials, tableId, TextUtil.getByteBuffer(start), TextUtil.getByteBuffer(end), flushID,
wait ? Long.MAX_VALUE : 1);
break;
} catch (TTransportException tte) {
@@ -829,7 +821,7 @@ public class TableOperationsImpl extends
MasterClient.execute(instance, new ClientExec<MasterClientService.Client>() {
@Override
public void execute(MasterClientService.Client client) throws Exception {
- client.setTableProperty(Tracer.traceInfo(), token.toThrift(), tableName, property, value);
+ client.setTableProperty(Tracer.traceInfo(), credentials, tableName, property, value);
}
});
}
@@ -852,7 +844,7 @@ public class TableOperationsImpl extends
MasterClient.execute(instance, new ClientExec<MasterClientService.Client>() {
@Override
public void execute(MasterClientService.Client client) throws Exception {
- client.removeTableProperty(Tracer.traceInfo(), token.toThrift(), tableName, property);
+ client.removeTableProperty(Tracer.traceInfo(), credentials, tableName, property);
}
});
}
@@ -1002,7 +994,7 @@ public class TableOperationsImpl extends
Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<String,Map<KeyExtent,List<Range>>>();
String tableId = Tables.getTableId(instance, tableName);
- TabletLocator tl = TabletLocator.getInstance(instance, token, new Text(tableId));
+ TabletLocator tl = TabletLocator.getInstance(instance, credentials, new Text(tableId));
// its possible that the cache could contain complete, but old information about a tables tablets... so clear it
tl.invalidateCache();
while (!tl.binRanges(Collections.singletonList(range), binnedRanges).isEmpty()) {
@@ -1143,7 +1135,7 @@ public class TableOperationsImpl extends
@Override
public void clearLocatorCache(String tableName) throws TableNotFoundException {
ArgumentChecker.notNull(tableName);
- TabletLocator tabLocator = TabletLocator.getInstance(instance, token, new Text(Tables.getTableId(instance, tableName)));
+ TabletLocator tabLocator = TabletLocator.getInstance(instance, credentials, new Text(Tables.getTableId(instance, tableName)));
tabLocator.invalidateCache();
}
@@ -1161,7 +1153,7 @@ public class TableOperationsImpl extends
public Text getMaxRow(String tableName, Authorizations auths, Text startRow, boolean startInclusive, Text endRow, boolean endInclusive)
throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
ArgumentChecker.notNull(tableName, auths);
- Scanner scanner = instance.getConnector(token.getToken()).createScanner(tableName, auths);
+ Scanner scanner = instance.getConnector(credentials.getPrincipal(), credentials.getToken()).createScanner(tableName, auths);
return FindMax.findMax(scanner, startRow, startInclusive, endRow, endInclusive);
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/BatchWriterImpl.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/BatchWriterImpl.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/BatchWriterImpl.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/BatchWriterImpl.java Mon Feb 4 18:09:38 2013
@@ -21,7 +21,7 @@ import org.apache.accumulo.core.client.B
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.MutationsRejectedException;
import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
+import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.accumulo.core.util.ArgumentChecker;
public class BatchWriterImpl implements BatchWriter {
@@ -29,7 +29,7 @@ public class BatchWriterImpl implements
private String table;
private TabletServerBatchWriter bw;
- public BatchWriterImpl(Instance instance, InstanceTokenWrapper credentials, String table, BatchWriterConfig config) {
+ public BatchWriterImpl(Instance instance, Credentials credentials, String table, BatchWriterConfig config) {
ArgumentChecker.notNull(instance, credentials, table, config);
this.table = table;
this.bw = new TabletServerBatchWriter(instance, credentials, config);
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java Mon Feb 4 18:09:38 2013
@@ -16,6 +16,7 @@
*/
package org.apache.accumulo.core.client.impl;
+import java.nio.ByteBuffer;
import java.util.concurrent.TimeUnit;
import org.apache.accumulo.core.client.AccumuloException;
@@ -39,17 +40,14 @@ import org.apache.accumulo.core.client.a
import org.apache.accumulo.core.client.impl.thrift.ClientService;
import org.apache.accumulo.core.master.state.tables.TableState;
import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
-import org.apache.accumulo.core.security.tokens.SecurityToken;
+import org.apache.accumulo.core.security.thrift.Credentials;
+import org.apache.accumulo.core.security.thrift.SecurityErrorCode;
import org.apache.accumulo.core.util.ArgumentChecker;
import org.apache.accumulo.trace.instrument.Tracer;
public class ConnectorImpl extends Connector {
private Instance instance;
-
- // There are places where we need information from the token. But we don't want to convert to a thrift object for every call.
- // So we'll keep both on hand and pass them around.
- private InstanceTokenWrapper token;
+ private Credentials credentials;
private SecurityOperations secops = null;
private TableOperations tableops = null;
private InstanceOperations instanceops = null;
@@ -58,25 +56,35 @@ public class ConnectorImpl extends Conne
*
* Use {@link Instance#getConnector(String, byte[])}
*
+<<<<<<< .working
+=======
+ * @param instance
+ * @param user
+ * @param password
+ * @throws AccumuloException
+ * @throws AccumuloSecurityException
+>>>>>>> .merge-right.r1438353
* @see Instance#getConnector(String user, byte[] password)
* @deprecated Not for client use
*/
@Deprecated
- public ConnectorImpl(Instance instance, final SecurityToken token2) throws AccumuloException, AccumuloSecurityException {
- ArgumentChecker.notNull(instance, token2);
+ public ConnectorImpl(Instance instance, String user, byte[] password) throws AccumuloException, AccumuloSecurityException {
+ ArgumentChecker.notNull(instance, user, password);
this.instance = instance;
// copy password so that user can clear it.... in future versions we can clear it...
-
- this.token = new InstanceTokenWrapper(token2, instance.getInstanceID());
+ byte[] passCopy = new byte[password.length];
+ System.arraycopy(password, 0, passCopy, 0, password.length);
+ this.credentials = new Credentials(user, ByteBuffer.wrap(password), instance.getInstanceID());
// hardcoded string for SYSTEM user since the definition is
// in server code
- if (!token.getPrincipal().equals("!SYSTEM")) {
+ if (!user.equals("!SYSTEM")) {
ServerClient.execute(instance, new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client iface) throws Exception {
- iface.authenticateUser(Tracer.traceInfo(), token.toThrift(), token.toThrift().token);
+ if (!iface.authenticateUser(Tracer.traceInfo(), credentials, credentials.getPrincipal(), credentials.token))
+ throw new AccumuloSecurityException("Authentication failed, access denied", SecurityErrorCode.BAD_CREDENTIALS);
}
});
}
@@ -97,7 +105,7 @@ public class ConnectorImpl extends Conne
@Override
public BatchScanner createBatchScanner(String tableName, Authorizations authorizations, int numQueryThreads) throws TableNotFoundException {
ArgumentChecker.notNull(tableName, authorizations);
- return new TabletServerBatchReader(instance, token, getTableId(tableName), authorizations, numQueryThreads);
+ return new TabletServerBatchReader(instance, credentials, getTableId(tableName), authorizations, numQueryThreads);
}
@Deprecated
@@ -105,7 +113,7 @@ public class ConnectorImpl extends Conne
public BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, long maxMemory, long maxLatency,
int maxWriteThreads) throws TableNotFoundException {
ArgumentChecker.notNull(tableName, authorizations);
- return new TabletServerBatchDeleter(instance, token, getTableId(tableName), authorizations, numQueryThreads, new BatchWriterConfig()
+ return new TabletServerBatchDeleter(instance, credentials, getTableId(tableName), authorizations, numQueryThreads, new BatchWriterConfig()
.setMaxMemory(maxMemory).setMaxLatency(maxLatency, TimeUnit.MILLISECONDS).setMaxWriteThreads(maxWriteThreads));
}
@@ -113,57 +121,57 @@ public class ConnectorImpl extends Conne
public BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, BatchWriterConfig config)
throws TableNotFoundException {
ArgumentChecker.notNull(tableName, authorizations);
- return new TabletServerBatchDeleter(instance, token, getTableId(tableName), authorizations, numQueryThreads, config);
+ return new TabletServerBatchDeleter(instance, credentials, getTableId(tableName), authorizations, numQueryThreads, config);
}
@Deprecated
@Override
public BatchWriter createBatchWriter(String tableName, long maxMemory, long maxLatency, int maxWriteThreads) throws TableNotFoundException {
ArgumentChecker.notNull(tableName);
- return new BatchWriterImpl(instance, token, getTableId(tableName), new BatchWriterConfig().setMaxMemory(maxMemory)
+ return new BatchWriterImpl(instance, credentials, getTableId(tableName), new BatchWriterConfig().setMaxMemory(maxMemory)
.setMaxLatency(maxLatency, TimeUnit.MILLISECONDS).setMaxWriteThreads(maxWriteThreads));
}
@Override
public BatchWriter createBatchWriter(String tableName, BatchWriterConfig config) throws TableNotFoundException {
ArgumentChecker.notNull(tableName);
- return new BatchWriterImpl(instance, token, getTableId(tableName), config);
+ return new BatchWriterImpl(instance, credentials, getTableId(tableName), config);
}
@Deprecated
@Override
public MultiTableBatchWriter createMultiTableBatchWriter(long maxMemory, long maxLatency, int maxWriteThreads) {
- return new MultiTableBatchWriterImpl(instance, token, new BatchWriterConfig().setMaxMemory(maxMemory).setMaxLatency(maxLatency, TimeUnit.MILLISECONDS)
- .setMaxWriteThreads(maxWriteThreads));
+ return new MultiTableBatchWriterImpl(instance, credentials, new BatchWriterConfig().setMaxMemory(maxMemory)
+ .setMaxLatency(maxLatency, TimeUnit.MILLISECONDS).setMaxWriteThreads(maxWriteThreads));
}
@Override
public MultiTableBatchWriter createMultiTableBatchWriter(BatchWriterConfig config) {
- return new MultiTableBatchWriterImpl(instance, token, config);
+ return new MultiTableBatchWriterImpl(instance, credentials, config);
}
@Override
public Scanner createScanner(String tableName, Authorizations authorizations) throws TableNotFoundException {
ArgumentChecker.notNull(tableName, authorizations);
- return new ScannerImpl(instance, token, getTableId(tableName), authorizations);
+ return new ScannerImpl(instance, credentials, getTableId(tableName), authorizations);
}
@Override
public String whoami() {
- return token.getPrincipal();
+ return credentials.getPrincipal();
}
@Override
public synchronized TableOperations tableOperations() {
if (tableops == null)
- tableops = new TableOperationsImpl(instance, token);
+ tableops = new TableOperationsImpl(instance, credentials);
return tableops;
}
@Override
public synchronized SecurityOperations securityOperations() {
if (secops == null)
- secops = new SecurityOperationsImpl(instance, token);
+ secops = new SecurityOperationsImpl(instance, credentials);
return secops;
}
@@ -171,7 +179,7 @@ public class ConnectorImpl extends Conne
@Override
public synchronized InstanceOperations instanceOperations() {
if (instanceops == null)
- instanceops = new InstanceOperationsImpl(instance, token);
+ instanceops = new InstanceOperationsImpl(instance, credentials);
return instanceops;
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java Mon Feb 4 18:09:38 2013
@@ -41,7 +41,7 @@ import org.apache.accumulo.core.data.Key
import org.apache.accumulo.core.data.PartialKey;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
+import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.core.util.OpTimer;
@@ -53,12 +53,12 @@ import org.apache.log4j.Logger;
public class MetadataLocationObtainer implements TabletLocationObtainer {
private static final Logger log = Logger.getLogger(MetadataLocationObtainer.class);
- private InstanceTokenWrapper credentials;
+ private Credentials credentials;
private SortedSet<Column> locCols;
private ArrayList<Column> columns;
private Instance instance;
- MetadataLocationObtainer(InstanceTokenWrapper credentials, Instance instance) {
+ MetadataLocationObtainer(Credentials credentials, Instance instance) {
this.instance = instance;
this.credentials = credentials;
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java Mon Feb 4 18:09:38 2013
@@ -29,7 +29,7 @@ import org.apache.accumulo.core.client.T
import org.apache.accumulo.core.client.TableOfflineException;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.master.state.tables.TableState;
-import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
+import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.accumulo.core.util.ArgumentChecker;
import org.apache.log4j.Logger;
@@ -72,7 +72,7 @@ public class MultiTableBatchWriterImpl i
private HashMap<String,BatchWriter> tableWriters;
private Instance instance;
- public MultiTableBatchWriterImpl(Instance instance, InstanceTokenWrapper credentials, BatchWriterConfig config) {
+ public MultiTableBatchWriterImpl(Instance instance, Credentials credentials, BatchWriterConfig config) {
ArgumentChecker.notNull(instance, credentials);
this.instance = instance;
this.bw = new TabletServerBatchWriter(instance, credentials, config);
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java Mon Feb 4 18:09:38 2013
@@ -55,7 +55,7 @@ import org.apache.accumulo.core.iterator
import org.apache.accumulo.core.master.state.tables.TableState;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.ColumnVisibility;
-import org.apache.accumulo.core.security.tokens.SecurityToken;
+import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.accumulo.core.util.ArgumentChecker;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.accumulo.core.util.LocalityGroupUtil;
@@ -121,7 +121,7 @@ class OfflineIterator implements Iterato
* @param authorizations
* @param table
*/
- public OfflineIterator(ScannerOptions options, Instance instance, SecurityToken credentials, Authorizations authorizations, Text table, Range range) {
+ public OfflineIterator(ScannerOptions options, Instance instance, Credentials credentials, Authorizations authorizations, Text table, Range range) {
this.options = new ScannerOptions(options);
this.instance = instance;
this.range = range;
@@ -135,7 +135,7 @@ class OfflineIterator implements Iterato
this.readers = new ArrayList<SortedKeyValueIterator<Key,Value>>();
try {
- conn = instance.getConnector(credentials);
+ conn = instance.getConnector(credentials.getPrincipal(), credentials.getToken());
nextTablet();
while (iter != null && !iter.hasTop())
@@ -343,11 +343,11 @@ public class OfflineScanner extends Scan
private Range range;
private Instance instance;
- private SecurityToken credentials;
+ private Credentials credentials;
private Authorizations authorizations;
private Text tableId;
- public OfflineScanner(Instance instance, SecurityToken credentials, String tableId, Authorizations authorizations) {
+ public OfflineScanner(Instance instance, Credentials credentials, String tableId, Authorizations authorizations) {
ArgumentChecker.notNull(instance, credentials, tableId, authorizations);
this.instance = instance;
this.credentials = credentials;
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java Mon Feb 4 18:09:38 2013
@@ -38,7 +38,7 @@ import org.apache.accumulo.core.data.Key
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
+import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.accumulo.core.util.ArgumentChecker;
import org.apache.hadoop.io.Text;
@@ -50,7 +50,7 @@ public class ScannerImpl extends Scanner
// and just query for the next highest row from the tablet server
private Instance instance;
- private InstanceTokenWrapper credentials;
+ private Credentials credentials;
private Authorizations authorizations;
private Text table;
@@ -59,7 +59,7 @@ public class ScannerImpl extends Scanner
private Range range;
private boolean isolated = false;
- public ScannerImpl(Instance instance, InstanceTokenWrapper credentials, String table, Authorizations authorizations) {
+ public ScannerImpl(Instance instance, Credentials credentials, String table, Authorizations authorizations) {
ArgumentChecker.notNull(instance, credentials, table, authorizations);
this.instance = instance;
this.credentials = credentials;
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java?rev=1442284&r1=1442283&r2=1442284&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java Mon Feb 4 18:09:38 2013
@@ -39,7 +39,7 @@ import org.apache.accumulo.core.data.Key
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.tokens.InstanceTokenWrapper;
+import org.apache.accumulo.core.security.thrift.Credentials;
import org.apache.accumulo.core.util.NamingThreadFactory;
import org.apache.hadoop.io.Text;
import org.apache.log4j.Logger;
@@ -55,7 +55,7 @@ public class ScannerIterator implements
// scanner state
private Iterator<KeyValue> iter;
private ScanState scanState;
- private InstanceTokenWrapper credentials;
+ private Credentials credentials;
private Instance instance;
private ScannerOptions options;
@@ -121,7 +121,7 @@ public class ScannerIterator implements
}
- ScannerIterator(Instance instance, InstanceTokenWrapper credentials, Text table, Authorizations authorizations, Range range, int size, int timeOut,
+ ScannerIterator(Instance instance, Credentials credentials, Text table, Authorizations authorizations, Range range, int size, int timeOut,
ScannerOptions options, boolean isolated) {
this.instance = instance;
this.tableName = new Text(table);