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

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


  }
 
  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


    MigrationCleanupThread migrationCleanupThread = new MigrationCleanupThread();
    migrationCleanupThread.start();
   
    tserverSet.startListeningForTabletServerChanges();
   
    AuthInfo systemAuths = SecurityConstants.getSystemCredentials();
    final TabletStateStore stores[] = {new ZooTabletStateStore(new ZooStore(zroot)), new RootTabletStateStore(instance, systemAuths, this),
        new MetaDataStateStore(instance, systemAuths, this)};
    for (int i = 0; i < stores.length; i++) {
      watchers.add(new TabletGroupWatcher(stores[i]));
    }
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

      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

      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

      } // 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

    }
    String[] rargs = cl.getArgs();
   
    int numQueries = Integer.parseInt(rargs[0]);
    int numThreads = Integer.parseInt(rargs[1]);
    credentials = new AuthInfo(cl.getOptionValue("username", "root"), 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

     
      BatchWriter bw = null;
      MyMapFile.Writer mfw = null;
     
      if (ingestArgs.outputToMapFile) {
        rootCredentials = new AuthInfo(username, passwd.getBytes(), instance.getInstanceID());
        FileSystem fs = FileSystem.get(CachedConfiguration.getInstance());
        mfw = new MyMapFile.Writer(CachedConfiguration.getInstance(), fs, ingestArgs.outputFile, Key.class, Value.class, CompressionType.BLOCK);
      } else {
        rootCredentials = new AuthInfo(username, passwd.getBytes(), instance.getInstanceID());
        Connector connector = instance.getConnector(rootCredentials.user, rootCredentials.password);
        bw = connector.createBatchWriter("test_ingest", 20000000l, 60000l, 10);
      }
     
      Authenticator authenticator = ZKAuthenticator.getInstance();
View Full Code Here

    if (!authenticate(credentials))
      throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.BAD_CREDENTIALS);
    if (!credentials.user.equals(user) && !hasSystemPermission(credentials, credentials.user, SystemPermission.SYSTEM))
      throw new AccumuloSecurityException(credentials.user, SecurityErrorCode.PERMISSION_DENIED);
   
    return authenticate(new AuthInfo(user, pass, credentials.instanceId));
  }
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.