You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2013/02/24 13:30:14 UTC
svn commit: r1449467 [7/9] - in /accumulo/branches/ACCUMULO-259-polishing:
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...
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/MetadataTable.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/MetadataTable.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/MetadataTable.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/MetadataTable.java Sun Feb 24 12:30:11 2013
@@ -40,7 +40,7 @@ import org.apache.accumulo.core.data.Par
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.CredentialHelper;
-import org.apache.accumulo.core.security.thrift.Credential;
+import org.apache.accumulo.core.security.thrift.TCredentials;
import org.apache.hadoop.io.Text;
public class MetadataTable {
@@ -170,7 +170,7 @@ public class MetadataTable {
return new Pair<SortedMap<KeyExtent,Text>,List<KeyExtent>>(results, locationless);
}
- public static SortedMap<Text,SortedMap<ColumnFQ,Value>> getTabletEntries(Instance instance, KeyExtent ke, List<ColumnFQ> columns, Credential credentials) {
+ public static SortedMap<Text,SortedMap<ColumnFQ,Value>> getTabletEntries(Instance instance, KeyExtent ke, List<ColumnFQ> columns, TCredentials credentials) {
TreeMap<Key,Value> tkv = new TreeMap<Key,Value>();
getTabletAndPrevTabletKeyValues(instance, tkv, ke, columns, credentials);
return getTabletEntries(tkv, columns);
@@ -204,7 +204,7 @@ public class MetadataTable {
return tabletEntries;
}
- public static void getTabletAndPrevTabletKeyValues(Instance instance, SortedMap<Key,Value> tkv, KeyExtent ke, List<ColumnFQ> columns, Credential credentials) {
+ public static void getTabletAndPrevTabletKeyValues(Instance instance, SortedMap<Key,Value> tkv, KeyExtent ke, List<ColumnFQ> columns, TCredentials credentials) {
Text startRow;
Text endRow = ke.getMetadataEntry();
@@ -237,7 +237,7 @@ public class MetadataTable {
}
}
- public static void getEntries(Instance instance, Credential credentials, String table, boolean isTid, Map<KeyExtent,String> locations,
+ public static void getEntries(Instance instance, TCredentials credentials, String table, boolean isTid, Map<KeyExtent,String> locations,
SortedSet<KeyExtent> tablets) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
String tableId = isTid ? table : Tables.getNameToIdMap(instance).get(table);
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java Sun Feb 24 12:30:11 2013
@@ -53,7 +53,7 @@ import org.apache.accumulo.core.data.Val
import org.apache.accumulo.core.data.thrift.TConstraintViolationSummary;
import org.apache.accumulo.core.security.AuditLevel;
import org.apache.accumulo.core.security.CredentialHelper;
-import org.apache.accumulo.core.security.thrift.Credential;
+import org.apache.accumulo.core.security.thrift.TCredentials;
import org.apache.accumulo.core.security.tokens.PasswordToken;
import org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException;
import org.apache.accumulo.core.trace.DistributedTrace;
@@ -169,7 +169,7 @@ public class Shell extends ShellOptions
protected Instance instance;
private Connector connector;
protected ConsoleReader reader;
- private Credential credentials;
+ private TCredentials credentials;
private Class<? extends Formatter> defaultFormatterClass = DefaultFormatter.class;
private Class<? extends Formatter> binaryFormatterClass = BinaryFormatter.class;
public Map<String,List<IteratorSetting>> scanIteratorOptions = new HashMap<String,List<IteratorSetting>>();
@@ -278,7 +278,7 @@ public class Shell extends ShellOptions
pass = passw.getBytes();
this.setTableName("");
connector = instance.getConnector(user, pass);
- this.credentials = CredentialHelper.create(user, new PasswordToken().setPassword(pass), connector.getInstance().getInstanceID());
+ this.credentials = CredentialHelper.create(user, new PasswordToken(pass), connector.getInstance().getInstanceID());
} catch (Exception e) {
printException(e);
@@ -318,8 +318,8 @@ public class Shell extends ShellOptions
new TablesCommand()};
Command[] tableControlCommands = {new AddSplitsCommand(), new CompactCommand(), new ConstraintCommand(), new FlushCommand(), new GetGroupsCommand(),
new GetSplitsCommand(), new MergeCommand(), new SetGroupsCommand()};
- Command[] userCommands = {new AddAuthsCommand(), new CreateUserCommand(), new DeleteUserCommand(), new DropUserCommand(), new GetAuthsCommand(), new PasswdCommand(),
- new SetAuthsCommand(), new UsersCommand()};
+ Command[] userCommands = {new AddAuthsCommand(), new CreateUserCommand(), new DeleteUserCommand(), new DropUserCommand(), new GetAuthsCommand(),
+ new PasswdCommand(), new SetAuthsCommand(), new UsersCommand()};
commandGrouping.put("-- Writing, Reading, and Removing Data --", dataCommands);
commandGrouping.put("-- Debugging Commands -------------------", debuggingCommands);
commandGrouping.put("-- Shell Execution Commands -------------", execCommands);
@@ -749,6 +749,7 @@ public class Shell extends ShellOptions
this.reader = reader;
}
+ @Override
public void print(String s) {
try {
reader.printString(s + "\n");
@@ -757,6 +758,7 @@ public class Shell extends ShellOptions
}
}
+ @Override
public void close() {}
};
@@ -767,10 +769,12 @@ public class Shell extends ShellOptions
writer = new PrintWriter(filename);
}
+ @Override
public void print(String s) {
writer.println(s);
}
+ @Override
public void close() {
writer.close();
}
@@ -779,7 +783,7 @@ public class Shell extends ShellOptions
public final void printLines(Iterator<String> lines, boolean paginate) throws IOException {
printLines(lines, paginate, null);
}
-
+
public final void printLines(Iterator<String> lines, boolean paginate, PrintLine out) throws IOException {
int linesPrinted = 0;
String prompt = "-- hit any key to continue or 'q' to quit --";
@@ -934,12 +938,12 @@ public class Shell extends ShellOptions
return reader;
}
- public void updateUser(Credential authInfo) throws AccumuloException, AccumuloSecurityException {
+ public void updateUser(TCredentials authInfo) throws AccumuloException, AccumuloSecurityException {
connector = instance.getConnector(authInfo);
credentials = authInfo;
}
- public Credential getCredentials() {
+ public TCredentials getCredentials() {
return credentials;
}
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/commands/PasswdCommand.java Sun Feb 24 12:30:11 2013
@@ -69,7 +69,7 @@ public class PasswdCommand extends Comma
// update the current credentials if the password changed was for
// the current user
if (shellState.getConnector().whoami().equals(user)) {
- shellState.updateUser(CredentialHelper.create(user, new PasswordToken().setPassword(pass), shellState.getConnector().getInstance().getInstanceID()));
+ shellState.updateUser(CredentialHelper.create(user, new PasswordToken(pass), shellState.getConnector().getInstance().getInstanceID()));
}
Shell.log.debug("Changed password for user " + user);
return 0;
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserCommand.java Sun Feb 24 12:30:11 2013
@@ -17,14 +17,12 @@
package org.apache.accumulo.core.util.shell.commands;
import java.io.IOException;
-import java.nio.ByteBuffer;
import java.util.Map;
import java.util.Set;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.security.CredentialHelper;
-import org.apache.accumulo.core.security.thrift.Credential;
import org.apache.accumulo.core.security.tokens.PasswordToken;
import org.apache.accumulo.core.util.shell.Shell;
import org.apache.accumulo.core.util.shell.Shell.Command;
@@ -32,6 +30,7 @@ import org.apache.accumulo.core.util.she
import org.apache.commons.cli.CommandLine;
public class UserCommand extends Command {
+ @Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws AccumuloException, AccumuloSecurityException, IOException {
// save old credentials and connection in case of failure
String user = cl.getArgs()[0];
@@ -46,7 +45,7 @@ public class UserCommand extends Command
return 0;
} // user canceled
pass = p.getBytes();
- shellState.updateUser(CredentialHelper.create(user, new PasswordToken().setPassword(pass), shellState.getConnector().getInstance().getInstanceID()));
+ shellState.updateUser(CredentialHelper.create(user, new PasswordToken(pass), shellState.getConnector().getInstance().getInstanceID()));
return 0;
}
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/client.thrift
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/client.thrift?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/client.thrift (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/client.thrift Sun Feb 24 12:30:11 2013
@@ -71,31 +71,39 @@ service ClientService {
string getInstanceId()
string getZooKeepers()
- list<string> bulkImportFiles(1:trace.TInfo tinfo, 2:security.Credential credential, 3:i64 tid, 4:string tableId, 5:list<string> files, 6:string errorDir, 7:bool setTime) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope);
+ list<string> bulkImportFiles(1:trace.TInfo tinfo, 8:security.TCredentials credentials, 3:i64 tid, 4:string tableId, 5:list<string> files, 6:string errorDir, 7:bool setTime) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope);
// ensures that nobody is working on the transaction id above
bool isActive(1:trace.TInfo tinfo, 2:i64 tid),
- void ping(1:security.Credential credential) throws (1:security.ThriftSecurityException sec)
+ void ping(2:security.TCredentials credentials) throws (1:security.ThriftSecurityException sec)
// user management methods
- bool authenticateUser(4:trace.TInfo tinfo, 1:security.Credential credential, 2:security.Credential toAuthenticate) throws (1:security.ThriftSecurityException sec)
- set<string> listUsers(2:trace.TInfo tinfo, 1:security.Credential credential) throws (1:security.ThriftSecurityException sec)
- void createUser(5:trace.TInfo tinfo, 1:security.Credential credential, 2:security.Credential toCreate, 4:list<binary> authorizations) throws (1:security.ThriftSecurityException sec)
- void dropUser(3:trace.TInfo tinfo, 1:security.Credential credential, 2:string principal) throws (1:security.ThriftSecurityException sec)
- void changePassword(4:trace.TInfo tinfo, 1:security.Credential credential, 2:security.Credential toChange) throws (1:security.ThriftSecurityException sec)
- void changeAuthorizations(4:trace.TInfo tinfo, 1:security.Credential credential, 2:string principal, 3:list<binary> authorizations) throws (1:security.ThriftSecurityException sec)
- list<binary> getUserAuthorizations(3:trace.TInfo tinfo, 1:security.Credential credential, 2:string principal) throws (1:security.ThriftSecurityException sec)
- bool hasSystemPermission(4:trace.TInfo tinfo, 1:security.Credential credential, 2:string principal, 3:byte sysPerm) throws (1:security.ThriftSecurityException sec)
- bool hasTablePermission(5:trace.TInfo tinfo, 1:security.Credential credential, 2:string principal, 3:string tableName, 4:byte tblPerm) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope)
- void grantSystemPermission(4:trace.TInfo tinfo, 1:security.Credential credential, 2:string principal, 3:byte permission) throws (1:security.ThriftSecurityException sec)
- void revokeSystemPermission(4:trace.TInfo tinfo, 1:security.Credential credential, 2:string principal, 3:byte permission) throws (1:security.ThriftSecurityException sec)
- void grantTablePermission(5:trace.TInfo tinfo, 1:security.Credential credential, 2:string principal, 3:string tableName, 4:byte permission) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope)
- void revokeTablePermission(5:trace.TInfo tinfo, 1:security.Credential credential, 2:string principal, 3:string tableName, 4:byte permission) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope)
-
+ set<string> listLocalUsers(2:trace.TInfo tinfo, 3:security.TCredentials credentials) throws (1:security.ThriftSecurityException sec)
+ void createLocalUser(5:trace.TInfo tinfo, 6:security.TCredentials credentials, 2:string principal, 3:binary password) throws (1:security.ThriftSecurityException sec)
+ void dropLocalUser(3:trace.TInfo tinfo, 4:security.TCredentials credentials, 2:string principal) throws (1:security.ThriftSecurityException sec)
+ void changeLocalUserPassword(4:trace.TInfo tinfo, 5:security.TCredentials credentials, 2:string principal, 3:binary password) throws (1:security.ThriftSecurityException sec)
+
+ // authentication-related methods
+ bool authenticate(1:trace.TInfo tinfo, 2:security.TCredentials credentials) throws (1:security.ThriftSecurityException sec)
+ bool authenticateUser(1:trace.TInfo tinfo, 2:security.TCredentials credentials, 3:security.TCredentials toAuth) throws (1:security.ThriftSecurityException sec)
+
+ // authorization-related methods
+ void changeAuthorizations(4:trace.TInfo tinfo, 5:security.TCredentials credentials, 2:string principal, 3:list<binary> authorizations) throws (1:security.ThriftSecurityException sec)
+ list<binary> getUserAuthorizations(3:trace.TInfo tinfo, 4:security.TCredentials credentials, 2:string principal) throws (1:security.ThriftSecurityException sec)
+
+ // permissions-related methods
+ bool hasSystemPermission(4:trace.TInfo tinfo, 5:security.TCredentials credentials, 2:string principal, 3:byte sysPerm) throws (1:security.ThriftSecurityException sec)
+ bool hasTablePermission(5:trace.TInfo tinfo, 6:security.TCredentials credentials, 2:string principal, 3:string tableName, 4:byte tblPerm) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope)
+ void grantSystemPermission(4:trace.TInfo tinfo, 5:security.TCredentials credentials, 2:string principal, 3:byte permission) throws (1:security.ThriftSecurityException sec)
+ void revokeSystemPermission(4:trace.TInfo tinfo, 5:security.TCredentials credentials, 2:string principal, 3:byte permission) throws (1:security.ThriftSecurityException sec)
+ void grantTablePermission(5:trace.TInfo tinfo, 6:security.TCredentials credentials, 2:string principal, 3:string tableName, 4:byte permission) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope)
+ void revokeTablePermission(5:trace.TInfo tinfo, 6:security.TCredentials credentials, 2:string principal, 3:string tableName, 4:byte permission) throws (1:security.ThriftSecurityException sec, 2:ThriftTableOperationException tope)
+
+ // configuration methods
map<string, string> getConfiguration(1:ConfigurationType type);
map<string, string> getTableConfiguration(2:string tableName) throws (1:ThriftTableOperationException tope);
bool checkClass(1:trace.TInfo tinfo, 2:string className, 3:string interfaceMatch);
- }
+}
// Only used for a unit test
service ThriftTest {
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/gc.thrift
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/gc.thrift?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/gc.thrift (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/gc.thrift Sun Feb 24 12:30:11 2013
@@ -38,5 +38,5 @@ struct GCStatus {
service GCMonitorService {
- GCStatus getStatus(2:trace.TInfo tinfo, 1:security.Credential credential) throws (1:security.ThriftSecurityException sec);
+ GCStatus getStatus(2:trace.TInfo tinfo, 1:security.TCredentials credentials) throws (1:security.ThriftSecurityException sec);
}
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/master.thrift
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/master.thrift?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/master.thrift (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/master.thrift Sun Feb 24 12:30:11 2013
@@ -132,31 +132,31 @@ enum TableOperation {
service MasterClientService {
// table management methods
- i64 initiateFlush(3:trace.TInfo tinfo, 1:security.Credential credential, 2:string tableName) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
- void waitForFlush(5:trace.TInfo tinfo, 1:security.Credential credential, 2:string tableName, 6:binary startRow, 7:binary endRow, 3:i64 flushID, 4:i64 maxLoops) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
+ i64 initiateFlush(3:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:string tableName) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
+ void waitForFlush(5:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:string tableName, 6:binary startRow, 7:binary endRow, 3:i64 flushID, 4:i64 maxLoops) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
- void setTableProperty(5:trace.TInfo tinfo, 1:security.Credential credential, 2:string tableName, 3:string property, 4:string value) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
- void removeTableProperty(4:trace.TInfo tinfo, 1:security.Credential credential, 2:string tableName, 3:string property) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
+ void setTableProperty(5:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:string tableName, 3:string property, 4:string value) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
+ void removeTableProperty(4:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:string tableName, 3:string property) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
// system management methods
- void setMasterGoalState(3:trace.TInfo tinfo, 1:security.Credential credential, 2:MasterGoalState state) throws (1:security.ThriftSecurityException sec);
- void shutdown(3:trace.TInfo tinfo, 1:security.Credential credential, 2:bool stopTabletServers) throws (1:security.ThriftSecurityException sec)
- void shutdownTabletServer(3:trace.TInfo tinfo, 1:security.Credential credential, 2:string tabletServer, 4:bool force) throws (1: security.ThriftSecurityException sec)
- void setSystemProperty(4:trace.TInfo tinfo, 1:security.Credential credential, 2:string property, 3:string value) throws (1:security.ThriftSecurityException sec)
- void removeSystemProperty(3:trace.TInfo tinfo, 1:security.Credential credential, 2:string property) throws (1:security.ThriftSecurityException sec)
+ void setMasterGoalState(3:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:MasterGoalState state) throws (1:security.ThriftSecurityException sec);
+ void shutdown(3:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:bool stopTabletServers) throws (1:security.ThriftSecurityException sec)
+ void shutdownTabletServer(3:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:string tabletServer, 4:bool force) throws (1: security.ThriftSecurityException sec)
+ void setSystemProperty(4:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:string property, 3:string value) throws (1:security.ThriftSecurityException sec)
+ void removeSystemProperty(3:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:string property) throws (1:security.ThriftSecurityException sec)
// system monitoring methods
- MasterMonitorInfo getMasterStats(2:trace.TInfo tinfo, 1:security.Credential credential) throws (1:security.ThriftSecurityException sec)
+ MasterMonitorInfo getMasterStats(2:trace.TInfo tinfo, 1:security.TCredentials credentials) throws (1:security.ThriftSecurityException sec)
// tablet server reporting
- oneway void reportSplitExtent(4:trace.TInfo tinfo, 1:security.Credential credential, 2:string serverName, 3:TabletSplit split)
- oneway void reportTabletStatus(5:trace.TInfo tinfo, 1:security.Credential credential, 2:string serverName, 3:TabletLoadState status, 4:data.TKeyExtent tablet)
+ oneway void reportSplitExtent(4:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:string serverName, 3:TabletSplit split)
+ oneway void reportTabletStatus(5:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:string serverName, 3:TabletLoadState status, 4:data.TKeyExtent tablet)
//table operations
- i64 beginTableOperation(2:trace.TInfo tinfo, 1:security.Credential credential) throws (1:security.ThriftSecurityException sec)
- void executeTableOperation(7:trace.TInfo tinfo, 1:security.Credential credential, 2:i64 opid, 3:TableOperation op, 4:list<binary> arguments, 5:map<string, string> options, 6:bool autoClean)throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
- string waitForTableOperation(3:trace.TInfo tinfo, 1:security.Credential credential, 2:i64 opid) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
- void finishTableOperation(3:trace.TInfo tinfo, 1:security.Credential credential, 2:i64 opid) throws (1:security.ThriftSecurityException sec)
+ i64 beginTableOperation(2:trace.TInfo tinfo, 1:security.TCredentials credentials) throws (1:security.ThriftSecurityException sec)
+ void executeTableOperation(7:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:i64 opid, 3:TableOperation op, 4:list<binary> arguments, 5:map<string, string> options, 6:bool autoClean)throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
+ string waitForTableOperation(3:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:i64 opid) throws (1:security.ThriftSecurityException sec, 2:client.ThriftTableOperationException tope)
+ void finishTableOperation(3:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:i64 opid) throws (1:security.ThriftSecurityException sec)
string getAuthenticatorClassName() throws (1:security.ThriftSecurityException tse);
}
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/security.thrift
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/security.thrift?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/security.thrift (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/security.thrift Sun Feb 24 12:30:11 2013
@@ -38,15 +38,16 @@ enum SecurityErrorCode {
INSUFFICIENT_PROPERTIES = 17;
}
+/* deprecated */
struct AuthInfo {
1:string user,
2:binary password,
3:string instanceId
}
-struct Credential {
+struct TCredentials {
1:string principal,
- 2:string tokenClass,
+ 2:string tokenClassName,
3:binary token,
4:string instanceId
}
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/tabletserver.thrift
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/tabletserver.thrift?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/tabletserver.thrift (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/main/thrift/tabletserver.thrift Sun Feb 24 12:30:11 2013
@@ -130,7 +130,7 @@ struct IteratorConfig {
service TabletClientService extends client.ClientService {
// scan a range of keys
data.InitialScan startScan(11:trace.TInfo tinfo,
- 1:security.Credential credential,
+ 1:security.TCredentials credentials,
2:data.TKeyExtent extent,
3:data.TRange range,
4:list<data.TColumn> columns,
@@ -146,7 +146,7 @@ service TabletClientService extends clie
// scan over a series of ranges
data.InitialMultiScan startMultiScan(8:trace.TInfo tinfo,
- 1:security.Credential credential,
+ 1:security.TCredentials credentials,
2:data.ScanBatch batch,
3:list<data.TColumn> columns,
4:list<data.IterInfo> ssiList,
@@ -157,37 +157,37 @@ service TabletClientService extends clie
void closeMultiScan(2:trace.TInfo tinfo, 1:data.ScanID scanID) throws (1:NoSuchScanIDException nssi),
//the following calls support a batch update to multiple tablets on a tablet server
- data.UpdateID startUpdate(2:trace.TInfo tinfo, 1:security.Credential credential) throws (1:security.ThriftSecurityException sec),
+ data.UpdateID startUpdate(2:trace.TInfo tinfo, 1:security.TCredentials credentials) throws (1:security.ThriftSecurityException sec),
oneway void applyUpdates(1:trace.TInfo tinfo, 2:data.UpdateID updateID, 3:data.TKeyExtent keyExtent, 4:list<data.TMutation> mutations),
data.UpdateErrors closeUpdate(2:trace.TInfo tinfo, 1:data.UpdateID updateID) throws (1:NoSuchScanIDException nssi),
//the following call supports making a single update to a tablet
- void update(4:trace.TInfo tinfo, 1:security.Credential credential, 2:data.TKeyExtent keyExtent, 3:data.TMutation mutation)
+ void update(4:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:data.TKeyExtent keyExtent, 3:data.TMutation mutation)
throws (1:security.ThriftSecurityException sec,
2:NotServingTabletException nste,
3:ConstraintViolationException cve),
// on success, returns an empty list
- list<data.TKeyExtent> bulkImport(3:trace.TInfo tinfo, 1:security.Credential credential, 4:i64 tid, 2:data.TabletFiles files, 5:bool setTime) throws (1:security.ThriftSecurityException sec),
+ list<data.TKeyExtent> bulkImport(3:trace.TInfo tinfo, 1:security.TCredentials credentials, 4:i64 tid, 2:data.TabletFiles files, 5:bool setTime) throws (1:security.ThriftSecurityException sec),
- void splitTablet(4:trace.TInfo tinfo, 1:security.Credential credential, 2:data.TKeyExtent extent, 3:binary splitPoint) throws (1:security.ThriftSecurityException sec, 2:NotServingTabletException nste)
+ void splitTablet(4:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:data.TKeyExtent extent, 3:binary splitPoint) throws (1:security.ThriftSecurityException sec, 2:NotServingTabletException nste)
- oneway void loadTablet(5:trace.TInfo tinfo, 1:security.Credential credential, 4:string lock, 2:data.TKeyExtent extent),
- oneway void unloadTablet(5:trace.TInfo tinfo, 1:security.Credential credential, 4:string lock, 2:data.TKeyExtent extent, 3:bool save),
- oneway void flush(4:trace.TInfo tinfo, 1:security.Credential credential, 3:string lock, 2:string tableId, 5:binary startRow, 6:binary endRow),
- oneway void flushTablet(1:trace.TInfo tinfo, 2:security.Credential credential, 3:string lock, 4:data.TKeyExtent extent),
- oneway void chop(1:trace.TInfo tinfo, 2:security.Credential credential, 3:string lock, 4:data.TKeyExtent extent),
- oneway void compact(1:trace.TInfo tinfo, 2:security.Credential credential, 3:string lock, 4:string tableId, 5:binary startRow, 6:binary endRow),
+ oneway void loadTablet(5:trace.TInfo tinfo, 1:security.TCredentials credentials, 4:string lock, 2:data.TKeyExtent extent),
+ oneway void unloadTablet(5:trace.TInfo tinfo, 1:security.TCredentials credentials, 4:string lock, 2:data.TKeyExtent extent, 3:bool save),
+ oneway void flush(4:trace.TInfo tinfo, 1:security.TCredentials credentials, 3:string lock, 2:string tableId, 5:binary startRow, 6:binary endRow),
+ oneway void flushTablet(1:trace.TInfo tinfo, 2:security.TCredentials credentials, 3:string lock, 4:data.TKeyExtent extent),
+ oneway void chop(1:trace.TInfo tinfo, 2:security.TCredentials credentials, 3:string lock, 4:data.TKeyExtent extent),
+ oneway void compact(1:trace.TInfo tinfo, 2:security.TCredentials credentials, 3:string lock, 4:string tableId, 5:binary startRow, 6:binary endRow),
- master.TabletServerStatus getTabletServerStatus(3:trace.TInfo tinfo, 1:security.Credential credential) throws (1:security.ThriftSecurityException sec)
- list<TabletStats> getTabletStats(3:trace.TInfo tinfo, 1:security.Credential credential, 2:string tableId) throws (1:security.ThriftSecurityException sec)
- TabletStats getHistoricalStats(2:trace.TInfo tinfo, 1:security.Credential credential) throws (1:security.ThriftSecurityException sec)
- void halt(3:trace.TInfo tinfo, 1:security.Credential credential, 2:string lock) throws (1:security.ThriftSecurityException sec)
- oneway void fastHalt(3:trace.TInfo tinfo, 1:security.Credential credential, 2:string lock);
+ master.TabletServerStatus getTabletServerStatus(3:trace.TInfo tinfo, 1:security.TCredentials credentials) throws (1:security.ThriftSecurityException sec)
+ list<TabletStats> getTabletStats(3:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:string tableId) throws (1:security.ThriftSecurityException sec)
+ TabletStats getHistoricalStats(2:trace.TInfo tinfo, 1:security.TCredentials credentials) throws (1:security.ThriftSecurityException sec)
+ void halt(3:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:string lock) throws (1:security.ThriftSecurityException sec)
+ oneway void fastHalt(3:trace.TInfo tinfo, 1:security.TCredentials credentials, 2:string lock);
- list<ActiveScan> getActiveScans(2:trace.TInfo tinfo, 1:security.Credential credential) throws (1:security.ThriftSecurityException sec)
- list<ActiveCompaction> getActiveCompactions(2:trace.TInfo tinfo, 1:security.Credential credential) throws (1:security.ThriftSecurityException sec)
- oneway void removeLogs(1:trace.TInfo tinfo, 2:security.Credential credential, 3:list<string> filenames)
+ list<ActiveScan> getActiveScans(2:trace.TInfo tinfo, 1:security.TCredentials credentials) throws (1:security.ThriftSecurityException sec)
+ list<ActiveCompaction> getActiveCompactions(2:trace.TInfo tinfo, 1:security.TCredentials credentials) throws (1:security.ThriftSecurityException sec)
+ oneway void removeLogs(1:trace.TInfo tinfo, 2:security.TCredentials credentials, 3:list<string> filenames)
}
typedef i32 TabletID
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java Sun Feb 24 12:30:11 2013
@@ -43,7 +43,7 @@ public class TestClientOpts {
BatchScannerOpts bsOpts = new BatchScannerOpts();
assertEquals(System.getProperty("user.name"), args.principal);
assertNull(args.securePassword);
- assertEquals(new PasswordToken().setPassword("secret".getBytes()), args.getToken());
+ assertEquals(new PasswordToken("secret"), args.getToken());
assertEquals(new Long(cfg.getMaxLatency(TimeUnit.MILLISECONDS)), bwOpts.batchLatency);
assertEquals(new Long(cfg.getTimeout(TimeUnit.MILLISECONDS)), bwOpts.batchTimeout);
assertEquals(new Long(cfg.getMaxMemory()), bwOpts.batchMemory);
@@ -54,30 +54,19 @@ public class TestClientOpts {
assertEquals(Constants.NO_AUTHS, args.auths);
assertEquals("localhost:2181", args.zookeepers);
assertFalse(args.help);
-
+
JCommander jc = new JCommander();
jc.addObject(args);
jc.addObject(bwOpts);
jc.addObject(bsOpts);
- jc.parse(
- "-u", "bar",
- "-p", "foo",
- "--batchLatency", "3s",
- "--batchTimeout", "2s",
- "--batchMemory", "1M",
- "--debug",
- "--trace",
- "--scanThreads", "7",
- "-i", "instance",
- "--auths", "G1,G2,G3",
- "-z", "zoohost1,zoohost2",
- "--help");
+ jc.parse("-u", "bar", "-p", "foo", "--batchLatency", "3s", "--batchTimeout", "2s", "--batchMemory", "1M", "--debug", "--trace", "--scanThreads", "7", "-i",
+ "instance", "--auths", "G1,G2,G3", "-z", "zoohost1,zoohost2", "--help");
assertEquals("bar", args.principal);
assertNull(args.securePassword);
- assertEquals(new PasswordToken().setPassword("foo".getBytes()), args.getToken());
+ assertEquals(new PasswordToken("foo"), args.getToken());
assertEquals(new Long(3000), bwOpts.batchLatency);
assertEquals(new Long(2000), bwOpts.batchTimeout);
- assertEquals(new Long(1024*1024), bwOpts.batchMemory);
+ assertEquals(new Long(1024 * 1024), bwOpts.batchMemory);
assertTrue(args.debug);
assertTrue(args.trace);
assertEquals(7, bsOpts.scanThreads.intValue());
@@ -87,5 +76,5 @@ public class TestClientOpts {
assertTrue(args.help);
}
-
+
}
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java Sun Feb 24 12:30:11 2013
@@ -48,8 +48,8 @@ import org.apache.accumulo.core.data.Par
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.thrift.AuthInfo;
-import org.apache.accumulo.core.security.thrift.Credential;
-import org.apache.accumulo.core.security.tokens.SecurityToken;
+import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.core.util.Pair;
import org.apache.hadoop.io.Text;
@@ -447,7 +447,7 @@ public class TabletLocatorImplTest exten
}
@Override
- public Connector getConnector(Credential auth) throws AccumuloException, AccumuloSecurityException {
+ public Connector getConnector(TCredentials auth) throws AccumuloException, AccumuloSecurityException {
return getConnector(auth.getPrincipal(), auth.getToken());
}
@@ -463,7 +463,7 @@ public class TabletLocatorImplTest exten
}
@Override
- public Connector getConnector(String principal, SecurityToken token) throws AccumuloException, AccumuloSecurityException {
+ public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
throw new UnsupportedOperationException();
}
}
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java Sun Feb 24 12:30:11 2013
@@ -24,9 +24,7 @@ import static org.junit.Assert.fail;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
-import java.nio.charset.Charset;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.BatchWriterConfig;
import org.apache.accumulo.core.client.Connector;
@@ -153,7 +151,7 @@ public class AccumuloFileOutputFormatTes
job.setInputFormat(AccumuloInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken().setPassword(pass.getBytes(Charset.forName("UTF-8"))));
+ AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
AccumuloInputFormat.setInputTableName(job, table);
AccumuloInputFormat.setMockInstance(job, INSTANCE_NAME);
AccumuloFileOutputFormat.setOutputPath(job, new Path(args[3]));
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java Sun Feb 24 12:30:11 2013
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertTru
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
-import java.nio.charset.Charset;
import java.util.List;
import org.apache.accumulo.core.client.BatchWriter;
@@ -246,7 +245,7 @@ public class AccumuloInputFormatTest {
job.setInputFormat(AccumuloInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken().setPassword(pass.getBytes(Charset.forName("UTF-8"))));
+ AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
AccumuloInputFormat.setInputTableName(job, table);
AccumuloInputFormat.setMockInstance(job, INSTANCE_NAME);
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java Sun Feb 24 12:30:11 2013
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertNul
import static org.junit.Assert.assertTrue;
import java.io.IOException;
-import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
@@ -111,7 +110,7 @@ public class AccumuloOutputFormatTest {
job.setInputFormat(AccumuloInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken().setPassword(pass.getBytes(Charset.forName("UTF-8"))));
+ AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
AccumuloInputFormat.setInputTableName(job, table1);
AccumuloInputFormat.setMockInstance(job, INSTANCE_NAME);
@@ -122,7 +121,7 @@ public class AccumuloOutputFormatTest {
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Mutation.class);
- AccumuloOutputFormat.setConnectorInfo(job, user, new PasswordToken().setPassword(pass.getBytes(Charset.forName("UTF-8"))));
+ AccumuloOutputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
AccumuloOutputFormat.setCreateTables(job, false);
AccumuloOutputFormat.setDefaultTableName(job, table2);
AccumuloOutputFormat.setMockInstance(job, INSTANCE_NAME);
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java Sun Feb 24 12:30:11 2013
@@ -21,7 +21,6 @@ import static org.junit.Assert.assertNul
import static org.junit.Assert.assertTrue;
import java.io.IOException;
-import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -165,7 +164,7 @@ public class AccumuloRowInputFormatTest
job.setInputFormat(AccumuloRowInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken().setPassword(pass.getBytes(Charset.forName("UTF-8"))));
+ AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
AccumuloInputFormat.setInputTableName(job, table);
AccumuloRowInputFormat.setMockInstance(job, INSTANCE_NAME);
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java Sun Feb 24 12:30:11 2013
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertTru
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
-import java.nio.charset.Charset;
import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.BatchWriterConfig;
@@ -142,7 +141,7 @@ public class AccumuloFileOutputFormatTes
job.setInputFormatClass(AccumuloInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken().setPassword(pass.getBytes(Charset.forName("UTF-8"))));
+ AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
AccumuloInputFormat.setInputTableName(job, table);
AccumuloInputFormat.setMockInstance(job, INSTANCE_NAME);
AccumuloFileOutputFormat.setOutputPath(job, new Path(args[3]));
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java Sun Feb 24 12:30:11 2013
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertTru
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
-import java.nio.charset.Charset;
import java.util.List;
import org.apache.accumulo.core.client.BatchWriter;
@@ -281,7 +280,7 @@ public class AccumuloInputFormatTest {
job.setInputFormatClass(AccumuloInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken().setPassword(pass.getBytes(Charset.forName("UTF-8"))));
+ AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
AccumuloInputFormat.setInputTableName(job, table);
AccumuloInputFormat.setMockInstance(job, INSTANCE_NAME);
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java Sun Feb 24 12:30:11 2013
@@ -23,7 +23,6 @@ import static org.junit.Assert.assertNul
import static org.junit.Assert.assertTrue;
import java.io.IOException;
-import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
@@ -102,7 +101,7 @@ public class AccumuloOutputFormatTest {
job.setInputFormatClass(AccumuloInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken().setPassword(pass.getBytes()));
+ AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
AccumuloInputFormat.setInputTableName(job, table1);
AccumuloInputFormat.setMockInstance(job, INSTANCE_NAME);
@@ -113,7 +112,7 @@ public class AccumuloOutputFormatTest {
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Mutation.class);
- AccumuloOutputFormat.setConnectorInfo(job, user, new PasswordToken().setPassword(pass.getBytes()));
+ AccumuloOutputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
AccumuloOutputFormat.setCreateTables(job, false);
AccumuloOutputFormat.setDefaultTableName(job, table2);
AccumuloOutputFormat.setMockInstance(job, INSTANCE_NAME);
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java Sun Feb 24 12:30:11 2013
@@ -21,7 +21,6 @@ import static org.junit.Assert.assertNul
import static org.junit.Assert.assertTrue;
import java.io.IOException;
-import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -158,7 +157,7 @@ public class AccumuloRowInputFormatTest
job.setInputFormatClass(AccumuloRowInputFormat.class);
- AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken().setPassword(pass.getBytes(Charset.forName("UTF-8"))));
+ AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
AccumuloInputFormat.setInputTableName(job, table);
AccumuloRowInputFormat.setMockInstance(job, INSTANCE_NAME);
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java Sun Feb 24 12:30:11 2013
@@ -84,7 +84,7 @@ public class MockConnectorTest {
@Test
public void testChangeAuths() throws Exception {
Connector c = new MockConnector("root", new MockInstance());
- c.securityOperations().createUser("greg", new PasswordToken().setPassword(new byte[0]));
+ c.securityOperations().createUser("greg", new PasswordToken(new byte[0]));
assertTrue(c.securityOperations().getUserAuthorizations("greg").isEmpty());
c.securityOperations().changeUserAuthorizations("greg", new Authorizations("A".getBytes()));
assertTrue(c.securityOperations().getUserAuthorizations("greg").contains("A".getBytes()));
@@ -314,7 +314,7 @@ public class MockConnectorTest {
count++;
}
assertEquals(1, count);
-
+
}
@Test
@@ -336,16 +336,15 @@ public class MockConnectorTest {
Entry<Key,Value> entry = scanner.iterator().next();
assertEquals("9", entry.getValue().toString());
-
+
}
@Test
- public void testMockConnectorReturnsCorrectInstance() throws AccumuloException,
- AccumuloSecurityException{
+ public void testMockConnectorReturnsCorrectInstance() throws AccumuloException, AccumuloSecurityException {
String name = "an-interesting-instance-name";
Instance mockInstance = new MockInstance(name);
assertEquals(mockInstance, mockInstance.getConnector("foo", "bar").getInstance());
- assertEquals(name, mockInstance.getConnector("foo","bar").getInstance().getInstanceName());
+ assertEquals(name, mockInstance.getConnector("foo", "bar").getInstance().getInstanceName());
}
-
+
}
Modified: accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java Sun Feb 24 12:30:11 2013
@@ -187,7 +187,7 @@ public class MockTableOperationsTest {
public void testImport() throws Throwable {
ImportTestFilesAndData dataAndFiles = prepareTestFiles();
Instance instance = new MockInstance("foo");
- Connector connector = instance.getConnector(CredentialHelper.create("user", new PasswordToken().setPassword(new byte[0]), "foo"));
+ Connector connector = instance.getConnector(CredentialHelper.create("user", new PasswordToken(new byte[0]), "foo"));
TableOperations tableOperations = connector.tableOperations();
tableOperations.create("a_table");
tableOperations.importDirectory("a_table", dataAndFiles.importPath.toString(), dataAndFiles.failurePath.toString(), false);
@@ -234,7 +234,7 @@ public class MockTableOperationsTest {
@Test(expected = TableNotFoundException.class)
public void testFailsWithNoTable() throws Throwable {
Instance instance = new MockInstance("foo");
- Connector connector = instance.getConnector(CredentialHelper.create("user", new PasswordToken().setPassword(new byte[0]), "foo"));
+ Connector connector = instance.getConnector(CredentialHelper.create("user", new PasswordToken(new byte[0]), "foo"));
TableOperations tableOperations = connector.tableOperations();
ImportTestFilesAndData testFiles = prepareTestFiles();
tableOperations.importDirectory("doesnt_exist_table", testFiles.importPath.toString(), testFiles.failurePath.toString(), false);
@@ -243,7 +243,7 @@ public class MockTableOperationsTest {
@Test(expected = IOException.class)
public void testFailsWithNonEmptyFailureDirectory() throws Throwable {
Instance instance = new MockInstance("foo");
- Connector connector = instance.getConnector(CredentialHelper.create("user", new PasswordToken().setPassword(new byte[0]), "foo"));
+ Connector connector = instance.getConnector(CredentialHelper.create("user", new PasswordToken(new byte[0]), "foo"));
TableOperations tableOperations = connector.tableOperations();
ImportTestFilesAndData testFiles = prepareTestFiles();
FileSystem fs = testFiles.failurePath.getFileSystem(new Configuration());
Modified: accumulo/branches/ACCUMULO-259-polishing/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/FileDataQuery.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/FileDataQuery.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/FileDataQuery.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/FileDataQuery.java Sun Feb 24 12:30:11 2013
@@ -31,7 +31,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.SecurityToken;
+import org.apache.accumulo.core.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.util.PeekingIterator;
/**
@@ -44,7 +44,7 @@ public class FileDataQuery {
private ChunkInputStream cis;
Scanner scanner;
- public FileDataQuery(String instanceName, String zooKeepers, String user, SecurityToken token, String tableName, Authorizations auths) throws AccumuloException,
+ public FileDataQuery(String instanceName, String zooKeepers, String user, AuthenticationToken token, String tableName, Authorizations auths) throws AccumuloException,
AccumuloSecurityException, TableNotFoundException {
ZooKeeperInstance instance = new ZooKeeperInstance(instanceName, zooKeepers);
conn = instance.getConnector(user, token);
Modified: accumulo/branches/ACCUMULO-259-polishing/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputFormatTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputFormatTest.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputFormatTest.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/examples/simple/src/test/java/org/apache/accumulo/examples/simple/filedata/ChunkInputFormatTest.java Sun Feb 24 12:30:11 2013
@@ -18,7 +18,6 @@ package org.apache.accumulo.examples.sim
import java.io.IOException;
import java.io.InputStream;
-import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
@@ -199,7 +198,7 @@ public class ChunkInputFormatTest extend
job.setInputFormatClass(ChunkInputFormat.class);
- ChunkInputFormat.setConnectorInfo(job, user, new PasswordToken().setPassword(pass.getBytes(Charset.forName("UTF-8"))));
+ ChunkInputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
ChunkInputFormat.setInputTableName(job, table);
ChunkInputFormat.setScanAuthorizations(job, AUTHS);
ChunkInputFormat.setMockInstance(job, instance);
Modified: accumulo/branches/ACCUMULO-259-polishing/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java Sun Feb 24 12:30:11 2013
@@ -65,9 +65,9 @@ import org.apache.accumulo.core.security
import org.apache.accumulo.core.security.CredentialHelper;
import org.apache.accumulo.core.security.SystemPermission;
import org.apache.accumulo.core.security.TablePermission;
-import org.apache.accumulo.core.security.thrift.Credential;
+import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.security.tokens.PasswordToken;
-import org.apache.accumulo.core.security.tokens.SecurityToken;
import org.apache.accumulo.core.util.ByteBufferUtil;
import org.apache.accumulo.core.util.TextUtil;
import org.apache.accumulo.proxy.thrift.AccumuloProxy;
@@ -134,7 +134,7 @@ public class ProxyServer implements Accu
protected Cache<UUID,ScannerPlusIterator> scannerCache;
protected Cache<UUID,BatchWriter> writerCache;
- protected Cache<ByteBuffer,Credential> tokenCache;
+ protected Cache<ByteBuffer,TCredentials> tokenCache;
private Random random = new Random();
public ProxyServer(Properties props) {
@@ -152,7 +152,7 @@ public class ProxyServer implements Accu
}
protected Connector getConnector(ByteBuffer login) throws Exception {
- Credential user = tokenCache.getIfPresent(login);
+ TCredentials user = tokenCache.getIfPresent(login);
if (user == null)
throw new org.apache.accumulo.proxy.thrift.AccumuloSecurityException("unknown user");
Connector connector = instance.getConnector(user);
@@ -319,7 +319,7 @@ public class ProxyServer implements Accu
if (auths != null) {
auth = getAuthorizations(auths);
} else {
- Credential token = tokenCache.getIfPresent(login);
+ TCredentials token = tokenCache.getIfPresent(login);
auth = connector.securityOperations().getUserAuthorizations(token.getPrincipal());
}
Text max = connector.tableOperations().getMaxRow(tableName, auth, startText, startinclusive, endText, endinclusive);
@@ -642,7 +642,7 @@ public class ProxyServer implements Accu
@Override
public void createUser(ByteBuffer login, String user, ByteBuffer password) throws TException {
try {
- SecurityToken st = new PasswordToken().setPassword(ByteBufferUtil.toBytes(password));
+ AuthenticationToken st = new PasswordToken(password);
getConnector(login).securityOperations().createUser(user, st);
} catch (Exception e) {
throw translateException(e);
@@ -747,7 +747,7 @@ public class ProxyServer implements Accu
if (opts != null && opts.isSetAuthorizations()) {
auth = getAuthorizations(opts.authorizations);
} else {
- Credential token = tokenCache.getIfPresent(login);
+ TCredentials token = tokenCache.getIfPresent(login);
auth = connector.securityOperations().getUserAuthorizations(token.getPrincipal());
}
Scanner scanner = connector.createScanner(tableName, auth);
@@ -796,7 +796,7 @@ public class ProxyServer implements Accu
if (opts != null && opts.isSetAuthorizations()) {
auth = getAuthorizations(opts.authorizations);
} else {
- Credential token = tokenCache.getIfPresent(login);
+ TCredentials token = tokenCache.getIfPresent(login);
auth = connector.securityOperations().getUserAuthorizations(token.getPrincipal());
}
if (opts != null && opts.threads > 0)
@@ -1186,8 +1186,7 @@ public class ProxyServer implements Accu
@Override
public ByteBuffer login(UserPass login) throws TException {
ByteBuffer result = ByteBuffer.wrap(Long.toHexString(random.nextLong()).getBytes());
- Credential credential = CredentialHelper.createSquelchError(login.getUsername(), new PasswordToken().setPassword(login.getPassword()),
- instance.getInstanceID());
+ TCredentials credential = CredentialHelper.createSquelchError(login.getUsername(), new PasswordToken(login.getPassword()), instance.getInstanceID());
tokenCache.put(result, credential);
return result;
}
Modified: accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java Sun Feb 24 12:30:11 2013
@@ -51,7 +51,7 @@ import org.apache.accumulo.core.data.thr
import org.apache.accumulo.core.file.FileOperations;
import org.apache.accumulo.core.file.FileSKVIterator;
import org.apache.accumulo.core.file.FileUtil;
-import org.apache.accumulo.core.security.thrift.Credential;
+import org.apache.accumulo.core.security.thrift.TCredentials;
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
import org.apache.accumulo.core.util.CachedConfiguration;
@@ -74,7 +74,7 @@ public class BulkImporter {
private static final Logger log = Logger.getLogger(BulkImporter.class);
- public static List<String> bulkLoad(AccumuloConfiguration conf, Instance instance, Credential creds, long tid, String tableId, List<String> files,
+ public static List<String> bulkLoad(AccumuloConfiguration conf, Instance instance, TCredentials creds, long tid, String tableId, List<String> files,
String errorDir, boolean setTime) throws IOException, AccumuloException, AccumuloSecurityException, ThriftTableOperationException {
AssignmentStats stats = new BulkImporter(conf, instance, creds, tid, tableId, setTime).importFiles(files, new Path(errorDir));
List<String> result = new ArrayList<String>();
@@ -91,13 +91,13 @@ public class BulkImporter {
}
private Instance instance;
- private Credential credentials;
+ private TCredentials credentials;
private String tableId;
private long tid;
private AccumuloConfiguration acuConf;
private boolean setTime;
- public BulkImporter(AccumuloConfiguration conf, Instance instance, Credential credentials, long tid, String tableId, boolean setTime) {
+ public BulkImporter(AccumuloConfiguration conf, Instance instance, TCredentials credentials, long tid, String tableId, boolean setTime) {
this.instance = instance;
this.credentials = credentials;
this.tid = tid;
@@ -415,7 +415,7 @@ public class BulkImporter {
return result;
}
- private Map<Path,List<KeyExtent>> assignMapFiles(AccumuloConfiguration acuConf, Instance instance, Configuration conf, Credential credentials, FileSystem fs,
+ private Map<Path,List<KeyExtent>> assignMapFiles(AccumuloConfiguration acuConf, Instance instance, Configuration conf, TCredentials credentials, FileSystem fs,
String tableId, Map<Path,List<TabletLocation>> assignments, Collection<Path> paths, int numThreads, int numMapThreads) {
timer.start(Timers.EXAMINE_MAP_FILES);
Map<Path,List<AssignmentInfo>> assignInfo = estimateSizes(acuConf, conf, fs, assignments, paths, numMapThreads);
@@ -433,10 +433,10 @@ public class BulkImporter {
private class AssignmentTask implements Runnable {
final Map<Path,List<KeyExtent>> assignmentFailures;
String location;
- Credential credentials;
+ TCredentials credentials;
private Map<KeyExtent,List<PathSize>> assignmentsPerTablet;
- public AssignmentTask(Credential credentials, Map<Path,List<KeyExtent>> assignmentFailures, String tableName, String location,
+ public AssignmentTask(TCredentials credentials, Map<Path,List<KeyExtent>> assignmentFailures, String tableName, String location,
Map<KeyExtent,List<PathSize>> assignmentsPerTablet) {
this.assignmentFailures = assignmentFailures;
this.location = location;
@@ -497,7 +497,7 @@ public class BulkImporter {
}
}
- private Map<Path,List<KeyExtent>> assignMapFiles(Credential credentials, String tableName, Map<Path,List<AssignmentInfo>> assignments,
+ private Map<Path,List<KeyExtent>> assignMapFiles(TCredentials credentials, String tableName, Map<Path,List<AssignmentInfo>> assignments,
Map<KeyExtent,String> locations, int numThreads) {
// group assignments by tablet
@@ -575,7 +575,7 @@ public class BulkImporter {
return assignmentFailures;
}
- private List<KeyExtent> assignMapFiles(Credential credentials, String location, Map<KeyExtent,List<PathSize>> assignmentsPerTablet) throws AccumuloException,
+ private List<KeyExtent> assignMapFiles(TCredentials credentials, String location, Map<KeyExtent,List<PathSize>> assignmentsPerTablet) throws AccumuloException,
AccumuloSecurityException {
try {
long timeInMillis = instance.getConfiguration().getTimeInMillis(Property.TSERV_BULK_TIMEOUT);
Modified: accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java Sun Feb 24 12:30:11 2013
@@ -36,11 +36,13 @@ import org.apache.accumulo.core.client.i
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.security.CredentialHelper;
import org.apache.accumulo.core.security.SystemPermission;
import org.apache.accumulo.core.security.TablePermission;
-import org.apache.accumulo.core.security.thrift.Credential;
import org.apache.accumulo.core.security.thrift.SecurityErrorCode;
+import org.apache.accumulo.core.security.thrift.TCredentials;
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
+import org.apache.accumulo.core.security.tokens.PasswordToken;
import org.apache.accumulo.server.conf.ServerConfiguration;
import org.apache.accumulo.server.security.AuditedSecurityOperation;
import org.apache.accumulo.server.security.SecurityOperation;
@@ -89,13 +91,23 @@ public class ClientServiceHandler implem
}
@Override
- public void ping(Credential credentials) {
+ public void ping(TCredentials credentials) {
// anybody can call this; no authentication check
log.info("Master reports: I just got pinged!");
}
@Override
- public boolean authenticateUser(TInfo tinfo, Credential credentials, Credential toAuth) throws ThriftSecurityException {
+ public boolean authenticate(TInfo tinfo, TCredentials credentials) throws ThriftSecurityException {
+ try {
+ return security.authenticateUser(credentials, credentials);
+ } catch (ThriftSecurityException e) {
+ log.error(e);
+ throw e;
+ }
+ }
+
+ @Override
+ public boolean authenticateUser(TInfo tinfo, TCredentials credentials, TCredentials toAuth) throws ThriftSecurityException {
try {
return security.authenticateUser(credentials, toAuth);
} catch (ThriftSecurityException e) {
@@ -105,69 +117,72 @@ public class ClientServiceHandler implem
}
@Override
- public void changeAuthorizations(TInfo tinfo, Credential credentials, String user, List<ByteBuffer> authorizations) throws ThriftSecurityException {
+ public void changeAuthorizations(TInfo tinfo, TCredentials credentials, String user, List<ByteBuffer> authorizations) throws ThriftSecurityException {
security.changeAuthorizations(credentials, user, new Authorizations(authorizations));
}
@Override
- public void changePassword(TInfo tinfo, Credential credentials, Credential toChange) throws ThriftSecurityException {
+ public void changeLocalUserPassword(TInfo tinfo, TCredentials credentials, String principal, ByteBuffer password) throws ThriftSecurityException {
+ PasswordToken token = new PasswordToken(password);
+ TCredentials toChange = CredentialHelper.createSquelchError(principal, token, credentials.instanceId);
security.changePassword(credentials, toChange);
}
@Override
- public void createUser(TInfo tinfo, Credential credentials, Credential newUser, List<ByteBuffer> authorizations)
- throws ThriftSecurityException {
- security.createUser(credentials, newUser, new Authorizations(authorizations));
+ public void createLocalUser(TInfo tinfo, TCredentials credentials, String principal, ByteBuffer password) throws ThriftSecurityException {
+ PasswordToken token = new PasswordToken(password);
+ TCredentials newUser = CredentialHelper.createSquelchError(principal, token, credentials.instanceId);
+ security.createUser(credentials, newUser, new Authorizations());
}
@Override
- public void dropUser(TInfo tinfo, Credential credentials, String user) throws ThriftSecurityException {
+ public void dropLocalUser(TInfo tinfo, TCredentials credentials, String user) throws ThriftSecurityException {
security.dropUser(credentials, user);
}
@Override
- public List<ByteBuffer> getUserAuthorizations(TInfo tinfo, Credential credentials, String user) throws ThriftSecurityException {
+ public List<ByteBuffer> getUserAuthorizations(TInfo tinfo, TCredentials credentials, String user) throws ThriftSecurityException {
return security.getUserAuthorizations(credentials, user).getAuthorizationsBB();
}
@Override
- public void grantSystemPermission(TInfo tinfo, Credential credentials, String user, byte permission) throws ThriftSecurityException {
+ public void grantSystemPermission(TInfo tinfo, TCredentials credentials, String user, byte permission) throws ThriftSecurityException {
security.grantSystemPermission(credentials, user, SystemPermission.getPermissionById(permission));
}
@Override
- public void grantTablePermission(TInfo tinfo, Credential credentials, String user, String tableName, byte permission) throws ThriftSecurityException,
+ public void grantTablePermission(TInfo tinfo, TCredentials credentials, String user, String tableName, byte permission) throws ThriftSecurityException,
ThriftTableOperationException {
String tableId = checkTableId(tableName, TableOperation.PERMISSION);
security.grantTablePermission(credentials, user, tableId, TablePermission.getPermissionById(permission));
}
@Override
- public void revokeSystemPermission(TInfo tinfo, Credential credentials, String user, byte permission) throws ThriftSecurityException {
+ public void revokeSystemPermission(TInfo tinfo, TCredentials credentials, String user, byte permission) throws ThriftSecurityException {
security.revokeSystemPermission(credentials, user, SystemPermission.getPermissionById(permission));
}
@Override
- public void revokeTablePermission(TInfo tinfo, Credential credentials, String user, String tableName, byte permission) throws ThriftSecurityException,
+ public void revokeTablePermission(TInfo tinfo, TCredentials credentials, String user, String tableName, byte permission) throws ThriftSecurityException,
ThriftTableOperationException {
String tableId = checkTableId(tableName, TableOperation.PERMISSION);
security.revokeTablePermission(credentials, user, tableId, TablePermission.getPermissionById(permission));
}
@Override
- public boolean hasSystemPermission(TInfo tinfo, Credential credentials, String user, byte sysPerm) throws ThriftSecurityException {
+ public boolean hasSystemPermission(TInfo tinfo, TCredentials credentials, String user, byte sysPerm) throws ThriftSecurityException {
return security.hasSystemPermission(credentials, user, SystemPermission.getPermissionById(sysPerm));
}
@Override
- public boolean hasTablePermission(TInfo tinfo, Credential credentials, String user, String tableName, byte tblPerm) throws ThriftSecurityException,
+ public boolean hasTablePermission(TInfo tinfo, TCredentials credentials, String user, String tableName, byte tblPerm) throws ThriftSecurityException,
ThriftTableOperationException {
String tableId = checkTableId(tableName, TableOperation.PERMISSION);
return security.hasTablePermission(credentials, user, tableId, TablePermission.getPermissionById(tblPerm));
}
@Override
- public Set<String> listUsers(TInfo tinfo, Credential credentials) throws ThriftSecurityException {
+ public Set<String> listLocalUsers(TInfo tinfo, TCredentials credentials) throws ThriftSecurityException {
return security.listUsers(credentials);
}
@@ -201,10 +216,10 @@ public class ClientServiceHandler implem
}
@Override
- public List<String> bulkImportFiles(TInfo tinfo, final Credential tikw, final long tid, final String tableId, final List<String> files,
+ public List<String> bulkImportFiles(TInfo tinfo, final TCredentials tikw, final long tid, final String tableId, final List<String> files,
final String errorDir, final boolean setTime) throws ThriftSecurityException, ThriftTableOperationException, TException {
try {
- final Credential credentials = new Credential(tikw);
+ final TCredentials credentials = new TCredentials(tikw);
if (!security.hasSystemPermission(credentials, credentials.getPrincipal(), SystemPermission.SYSTEM))
throw new AccumuloSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
return transactionWatcher.run(Constants.BULK_ARBITRATOR_TYPE, tid, new Callable<List<String>>() {
Modified: accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java Sun Feb 24 12:30:11 2013
@@ -34,10 +34,10 @@ import org.apache.accumulo.core.conf.Pro
import org.apache.accumulo.core.master.thrift.MasterClientService.Client;
import org.apache.accumulo.core.security.CredentialHelper;
import org.apache.accumulo.core.security.thrift.AuthInfo;
-import org.apache.accumulo.core.security.thrift.Credential;
+import org.apache.accumulo.core.security.thrift.TCredentials;
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
+import org.apache.accumulo.core.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.security.tokens.PasswordToken;
-import org.apache.accumulo.core.security.tokens.SecurityToken;
import org.apache.accumulo.core.util.ByteBufferUtil;
import org.apache.accumulo.core.util.OpTimer;
import org.apache.accumulo.core.util.StringUtil;
@@ -150,19 +150,20 @@ public class HdfsZooInstance implements
@Override
// Not really deprecated, just not for client use
- public Connector getConnector(String principal, SecurityToken token) throws AccumuloException, AccumuloSecurityException {
+ public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
return getConnector(CredentialHelper.create(principal, token, getInstanceID()));
}
+ @Override
@SuppressWarnings("deprecation")
- public Connector getConnector(Credential cred) throws AccumuloException, AccumuloSecurityException {
+ public Connector getConnector(TCredentials cred) throws AccumuloException, AccumuloSecurityException {
return new ConnectorImpl(this, cred);
}
@Override
// Not really deprecated, just not for client use
public Connector getConnector(String user, byte[] pass) throws AccumuloException, AccumuloSecurityException {
- return getConnector(user, new PasswordToken().setPassword(pass));
+ return getConnector(user, new PasswordToken(pass));
}
@Override
@@ -198,6 +199,7 @@ public class HdfsZooInstance implements
System.out.println("Masters: " + StringUtil.join(instance.getMasterLocations(), ", "));
}
+ @Deprecated
@Override
public Connector getConnector(AuthInfo auth) throws AccumuloException, AccumuloSecurityException {
return getConnector(auth.user, auth.getPassword());
Modified: accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java?rev=1449467&r1=1449466&r2=1449467&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java (original)
+++ accumulo/branches/ACCUMULO-259-polishing/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java Sun Feb 24 12:30:11 2013
@@ -60,7 +60,7 @@ import org.apache.accumulo.core.gc.thrif
import org.apache.accumulo.core.master.state.tables.TableState;
import org.apache.accumulo.core.security.CredentialHelper;
import org.apache.accumulo.core.security.SecurityUtil;
-import org.apache.accumulo.core.security.thrift.Credential;
+import org.apache.accumulo.core.security.thrift.TCredentials;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.accumulo.core.util.NamingThreadFactory;
import org.apache.accumulo.core.util.ServerServices;
@@ -120,7 +120,7 @@ public class SimpleGarbageCollector impl
private static final Logger log = Logger.getLogger(SimpleGarbageCollector.class);
- private Credential credentials;
+ private TCredentials credentials;
private long gcStartDelay;
private boolean checkForBulkProcessingFiles;
private FileSystem fs;
@@ -180,7 +180,7 @@ public class SimpleGarbageCollector impl
this.address = address;
}
- public void init(FileSystem fs, Instance instance, Credential credentials, boolean noTrash) throws IOException {
+ public void init(FileSystem fs, Instance instance, TCredentials credentials, boolean noTrash) throws IOException {
this.fs = TraceFileSystem.wrap(fs);
this.credentials = credentials;
this.instance = instance;
@@ -700,7 +700,7 @@ public class SimpleGarbageCollector impl
}
@Override
- public GCStatus getStatus(TInfo info, Credential credentials) {
+ public GCStatus getStatus(TInfo info, TCredentials credentials) {
return status;
}
}