Package org.apache.accumulo.core.client.security.tokens

Examples of org.apache.accumulo.core.client.security.tokens.PasswordToken


              reader.printNewline();
              return;
            } // user canceled
           
            try {
              authFailed = !connector.securityOperations().authenticateUser(connector.whoami(), new PasswordToken(pwd));
            } catch (Exception e) {
              ++exitCode;
              printException(e);
            }
           
View Full Code Here


 
  @Override
  public void changeLocalUserPassword(ByteBuffer login, String user, ByteBuffer password) throws org.apache.accumulo.proxy.thrift.AccumuloException,
      org.apache.accumulo.proxy.thrift.AccumuloSecurityException, TException {
    try {
      getConnector(login).securityOperations().changeLocalUserPassword(user, new PasswordToken(password));
    } catch (Exception e) {
      handleException(e);
    }
  }
View Full Code Here

 
  @Override
  public void createLocalUser(ByteBuffer login, String user, ByteBuffer password) throws org.apache.accumulo.proxy.thrift.AccumuloException,
      org.apache.accumulo.proxy.thrift.AccumuloSecurityException, TException {
    try {
      getConnector(login).securityOperations().createLocalUser(user, new PasswordToken(password));
    } catch (Exception e) {
      handleException(e);
    }
  }
View Full Code Here

    if (oldPassword == null) {
      shellState.getReader().printNewline();
      return 0;
    } // user canceled
   
    if (!shellState.getConnector().securityOperations().authenticateUser(currentUser, new PasswordToken(oldPassword)))
      throw new AccumuloSecurityException(user, SecurityErrorCode.BAD_CREDENTIALS);
   
    password = shellState.readMaskedLine("Enter new password for '" + user + "': ", '*');
    if (password == null) {
      shellState.getReader().printNewline();
      return 0;
    } // user canceled
    passwordConfirm = shellState.readMaskedLine("Please confirm new password for '" + user + "': ", '*');
    if (passwordConfirm == null) {
      shellState.getReader().printNewline();
      return 0;
    } // user canceled
   
    if (!password.equals(passwordConfirm)) {
      throw new IllegalArgumentException("Passwords do not match");
    }
    byte[] pass = password.getBytes(Constants.UTF8);
    shellState.getConnector().securityOperations().changeLocalUserPassword(user, new PasswordToken(pass));
    // update the current credentials if the password changed was for
    // the current user
    if (shellState.getConnector().whoami().equals(user)) {
      shellState.updateUser(user, new PasswordToken(pass));
    }
    Shell.log.debug("Changed password for user " + user);
    return 0;
  }
View Full Code Here

   *             {@link #setDefaultTableName(Job, String)} instead.
   */
  @Deprecated
  public static void setOutputInfo(Configuration conf, String user, byte[] passwd, boolean createTables, String defaultTable) {
    try {
      OutputConfigurator.setConnectorInfo(CLASS, conf, user, new PasswordToken(passwd));
    } catch (AccumuloSecurityException e) {
      throw new RuntimeException(e);
    }
    OutputConfigurator.setCreateTables(CLASS, conf, createTables);
    OutputConfigurator.setDefaultTableName(CLASS, conf, defaultTable);
View Full Code Here

   *             {@link #setScanAuthorizations(Job, Authorizations)} instead.
   */
  @Deprecated
  public static void setInputInfo(Configuration conf, String user, byte[] passwd, String table, Authorizations auths) {
    try {
      InputConfigurator.setConnectorInfo(CLASS, conf, user, new PasswordToken(passwd));
    } catch (AccumuloSecurityException e) {
      throw new RuntimeException(e);
    }
    InputConfigurator.setInputTableName(CLASS, conf, table);
    InputConfigurator.setScanAuthorizations(CLASS, conf, auths);
View Full Code Here

            .setNumTservers (1);
    accumulo = new MiniAccumuloCluster(config);
    accumulo.start();
    // wait for accumulo to be up and functional
    ZooKeeperInstance zoo = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
    Connector c = zoo.getConnector("root", new PasswordToken(secret.getBytes()));
    for (@SuppressWarnings("unused") Entry<org.apache.accumulo.core.data.Key,Value> entry : c.createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS))
        ;
   
    Properties props = new Properties();
    props.put("instance", accumulo.getInstanceName());
View Full Code Here

      }

    }
   
    if (securePassword != null)
      return new PasswordToken(securePassword.value);
   
    if (password != null)
      return new PasswordToken(password.value);
   
    return null;
  }
View Full Code Here

      log.error("M/R requires a jar file!  Run mvn package.");
      return 1;
    }
   
    job.setInputFormatClass(AccumuloInputFormat.class);
    AccumuloInputFormat.setConnectorInfo(job, args[0], new PasswordToken(args[1]));
    AccumuloInputFormat.setInputTableName(job, args[2]);
    AccumuloInputFormat.setZooKeeperInstance(job, args[3], args[4]);
   
    job.setMapperClass(SeqMapClass.class);
    job.setMapOutputKeyClass(NullWritable.class);
    job.setMapOutputValueClass(IntWritable.class);
   
    job.setReducerClass(SeqReduceClass.class);
    job.setNumReduceTasks(1);
   
    job.setOutputFormatClass(AccumuloOutputFormat.class);
    AccumuloOutputFormat.setConnectorInfo(job, args[0], new PasswordToken(args[1]));
    AccumuloOutputFormat.setCreateTables(job, true);
    AccumuloOutputFormat.setDefaultTableName(job, args[5]);
    AccumuloOutputFormat.setZooKeeperInstance(job, args[3], args[4]);
   
    job.waitForCompletion(true);
View Full Code Here

    } catch (IOException e) {
      throw new RuntimeException(e); // this is impossible with
      // ByteArrayOutputStream; crash hard
      // if this happens
    }
    return new PasswordToken(Base64.encodeBase64(bytes.toByteArray()));
  }
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.client.security.tokens.PasswordToken

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.