Package org.apache.accumulo.core.security.thrift

Examples of org.apache.accumulo.core.security.thrift.AuthInfo


      Set<String> unusedWalLogs = beginClearingUnusedLogs();
      try {
        // the order of writing to !METADATA and walog is important in the face of machine/process failures
        // need to write to !METADATA before writing to walog, when things are done in the reverse order
        // data could be lost
        AuthInfo creds = SecurityConstants.systemCredentials;
        MetadataTable.updateTabletDataFile(extent, relativePath, dfv, time, creds, tabletServer.getClientAddressString(), tabletServer.getLock(),
            unusedWalLogs, lastLocation);
      } finally {
        finishClearingUnusedLogs();
      }
View Full Code Here


  }
 
  public static class UserCommand extends Command {
    public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, AccumuloSecurityException, IOException {
      // save old credentials and connection in case of failure
      AuthInfo prevCreds = shellState.credentials;
      Connector prevConn = shellState.connector;
     
      boolean revertCreds = false;
      String user = cl.getArgs()[0];
      byte[] pass;
     
      // We can't let the wrapping try around the execute method deal
      // with the exceptions because we have to do something if one
      // of these methods fails
      try {
        String p = shellState.reader.readLine("Enter password for user " + user + ": ", '*');
        if (p == null) {
          shellState.reader.printNewline();
          return 0;
        } // user canceled
        pass = p.getBytes();
        shellState.credentials = new AuthInfo(user, pass, shellState.connector.getInstance().getInstanceID());
        shellState.connector = shellState.connector.getInstance().getConnector(user, pass);
      } catch (AccumuloException e) {
        revertCreds = true;
        throw e;
      } catch (AccumuloSecurityException e) {
View Full Code Here

      byte[] pass = password.getBytes();
      shellState.connector.securityOperations().changeUserPassword(user, pass);
      // update the current credentials if the password changed was for
      // the current user
      if (shellState.connector.whoami().equals(user))
        shellState.credentials = new AuthInfo(user, pass, shellState.connector.getInstance().getInstanceID());
      log.debug("Changed password for user " + user);
      return 0;
    }
View Full Code Here

      return new MockTabletLocator();
    Instance instance = getInstance(job);
    String username = getUsername(job);
    byte[] password = getPassword(job);
    String tableName = getTablename(job);
    return TabletLocator.getInstance(instance, new AuthInfo(username, password, instance.getInstanceID()), new Text(Tables.getTableId(instance, tableName)));
  }
View Full Code Here

      } // user canceled
     
      pass = passw.getBytes();
      this.tableName = "";
      connector = instance.getConnector(user, pass);
      this.credentials = new AuthInfo(user, pass, connector.getInstance().getInstanceID());
     
    } catch (Exception e) {
      printException(e);
      configError = true;
    }
View Full Code Here

        log.debug("Creating connector with user: " + user);
        Connector conn = instance.getConnector(user, password);
        log.debug("Creating scanner for table: " + getTablename(conf));
        log.debug("Authorizations are: " + authorizations);
        if (isOfflineScan(conf)) {
          scanner = new OfflineScanner(instance, new AuthInfo(user, ByteBuffer.wrap(password), instance.getInstanceID()), Tables.getTableId(instance,
              getTablename(conf)), authorizations);
        } else {
          scanner = conn.createScanner(getTablename(conf), authorizations);
        }
        if (isIsolated(conf)) {
View Full Code Here

      return new MockTabletLocator();
    Instance instance = getInstance(conf);
    String username = getUsername(conf);
    byte[] password = getPassword(conf);
    String tableName = getTablename(conf);
    return TabletLocator.getInstance(instance, new AuthInfo(username, ByteBuffer.wrap(password), instance.getInstanceID()),
        new Text(Tables.getTableId(instance, tableName)));
  }
View Full Code Here

    if (args.length > 1 || new HashSet<String>(Arrays.asList(args)).contains("-?")) {
      System.err.println("Usage: bin/accumulo " + AddFilesWithMissingEntries.class.getName() + " [update]");
      System.exit(1);
    }
    update = args.length > 0;
    final AuthInfo creds = SecurityConstants.getSystemCredentials();
    final Connector connector = HdfsZooInstance.getInstance().getConnector(creds.getUser(), creds.getPassword());
    final Key rootTableEnd = new Key(Constants.ROOT_TABLET_EXTENT.getEndRow());
    final Range range = new Range(rootTableEnd.followingKey(PartialKey.ROW), true, Constants.METADATA_RESERVED_KEYSPACE_START_KEY, false);
    final Scanner scanner = connector.createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
    scanner.setRange(range);
    final Configuration conf = new Configuration();
View Full Code Here

    }
    String[] rargs = cl.getArgs();
   
    int numQueries = Integer.parseInt(rargs[0]);
    int numThreads = Integer.parseInt(rargs[1]);
    credentials = new AuthInfo(cl.getOptionValue("username", "root"), ByteBuffer.wrap(cl.getOptionValue("password", "secret").getBytes()), HdfsZooInstance
        .getInstance().getInstanceID());
   
    Connector connector = HdfsZooInstance.getInstance().getConnector(credentials.user, credentials.password);
    Scanner scanner = connector.createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
    scanner.setBatchSize(20000);
View Full Code Here

    log.debug("removing the bulk processing flag file in " + bulk);
    Path bulkDir = new Path(bulk);
    MetadataTable.removeBulkLoadInProgressFlag("/" + bulkDir.getParent().getName() + "/" + bulkDir.getName());
    MetadataTable.addDeleteEntry(tableId, "/" + bulkDir.getName());
    log.debug("removing the metadata table markers for loaded files");
    AuthInfo creds = SecurityConstants.getSystemCredentials();
    Connector conn = HdfsZooInstance.getInstance().getConnector(creds.user, creds.password);
    MetadataTable.removeBulkLoadEntries(conn, tableId, tid);
    log.debug("releasing HDFS reservations for " + source + " and " + error);
    Utils.unreserveHdfsDirectory(source, tid);
    Utils.unreserveHdfsDirectory(error, tid);
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.security.thrift.AuthInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.