Package org.apache.accumulo.core.security

Examples of org.apache.accumulo.core.security.Credentials


  }

  @Override
  public void changeLocalUserPassword(final String principal, final PasswordToken token) throws AccumuloException, AccumuloSecurityException {
    ArgumentChecker.notNull(principal, token);
    final Credentials toChange = new Credentials(principal, token);
    execute(new ClientExec<ClientService.Client>() {
      @Override
      public void execute(ClientService.Client client) throws Exception {
        client.changeLocalUserPassword(Tracer.traceInfo(), credentials.toThrift(instance), principal, ByteBuffer.wrap(token.getPassword()));
      }
View Full Code Here


  }

  @Override
  public void changeLocalUserPassword(TInfo tinfo, TCredentials credentials, String principal, ByteBuffer password) throws ThriftSecurityException {
    PasswordToken token = new PasswordToken(password);
    Credentials toChange = new Credentials(principal, token);
    security.changePassword(credentials, toChange);
  }
View Full Code Here

  }

  @Override
  public void createLocalUser(TInfo tinfo, TCredentials credentials, String principal, ByteBuffer password) throws ThriftSecurityException {
    PasswordToken token = new PasswordToken(password);
    Credentials newUser = new Credentials(principal, token);
    security.createUser(credentials, newUser, new Authorizations());
  }
View Full Code Here

  }

  @Override
  public List<TDiskUsage> getDiskUsage(Set<String> tables, TCredentials credentials) throws ThriftTableOperationException, ThriftSecurityException, TException {
    try {
      final Credentials creds = Credentials.fromThrift(credentials);
      Connector conn = instance.getConnector(creds.getPrincipal(), creds.getToken());

      HashSet<String> tableIds = new HashSet<String>();

      for (String table : tables) {
        // ensure that table table exists
View Full Code Here

    assertEquals(SystemCredentials.get().getToken().getClass(), SystemToken.class);
  }
 
  @Test
  public void testSystemCredentials() {
    Credentials a = SystemCredentials.get();
    Credentials b = SystemCredentials.get();
    assertTrue(a == b);
  }
View Full Code Here

  }
 
  protected Connector getConnector(ByteBuffer login) throws Exception {
    String[] pair = new String(login.array(), login.position(), login.remaining(), Constants.UTF8).split(",", 2);
    if (instance.getInstanceID().equals(pair[0])) {
      Credentials creds = Credentials.deserialize(pair[1]);
      return instance.getConnector(creds.getPrincipal(), creds.getToken());
    } else {
      throw new org.apache.accumulo.core.client.AccumuloSecurityException(pair[0], org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.INVALID_INSTANCEID);
    }
  }
View Full Code Here

 
  @Override
  public ByteBuffer login(String principal, Map<String,String> loginProperties) throws org.apache.accumulo.proxy.thrift.AccumuloSecurityException, TException {
    try {
      AuthenticationToken token = getToken(principal, loginProperties);
      ByteBuffer login = ByteBuffer.wrap((instance.getInstanceID() + "," + new Credentials(principal, token).serialize()).getBytes(Constants.UTF8));
      getConnector(login); // check to make sure user exists
      return login;
    } catch (AccumuloSecurityException e) {
      throw new org.apache.accumulo.proxy.thrift.AccumuloSecurityException(e.toString());
    } catch (Exception e) {
View Full Code Here

    }
  }
 
  @Test
  public void testFindOverlappingTablets() throws Exception {
    Credentials credentials = null;
    MockTabletLocator locator = new MockTabletLocator();
    FileSystem fs = FileSystem.getLocal(CachedConfiguration.getInstance());
    AccumuloConfiguration acuConf = AccumuloConfiguration.getDefaultConfiguration();
    String file = "target/testFile.rf";
    fs.delete(new Path(file), true);
View Full Code Here

      log.error("Unable to find table named " + opts.tableName);
      System.exit(-1);
    }
   
    TreeMap<KeyExtent,String> tabletLocations = new TreeMap<KeyExtent,String>();
    List<KeyExtent> candidates = findTablets(!opts.selectFarTablets, new Credentials(opts.principal, opts.getToken()), opts.tableName, instance,
        tabletLocations);
   
    if (candidates.size() < opts.numThreads) {
      System.err.println("ERROR : Unable to find " + opts.numThreads + " " + (opts.selectFarTablets ? "far" : "local") + " tablets");
      System.exit(-1);
    }
   
    List<KeyExtent> tabletsToTest = selectRandomTablets(opts.numThreads, candidates);
   
    Map<KeyExtent,List<FileRef>> tabletFiles = new HashMap<KeyExtent,List<FileRef>>();
   
    for (KeyExtent ke : tabletsToTest) {
      List<FileRef> files = getTabletFiles(new Credentials(opts.principal, opts.getToken()), opts.getInstance(), tableId, ke);
      tabletFiles.put(ke, files);
    }
   
    System.out.println();
    System.out.println("run location      : " + InetAddress.getLocalHost().getHostName() + "/" + InetAddress.getLocalHost().getHostAddress());
View Full Code Here

    bw.addMutation(defaultTablet);
    bw.close();

    // Read out the TabletLocationStates
    MockCurrentState state = new MockCurrentState(new MergeInfo(new KeyExtent(tableId, new Text("p"), new Text("e")), MergeInfo.Operation.MERGE));
    Credentials credentials = new Credentials("root", new PasswordToken(new byte[0]));

    // Verify the tablet state: hosted, and count
    MetaDataStateStore metaDataStateStore = new MetaDataStateStore(instance, credentials, state);
    int count = 0;
    for (TabletLocationState tss : metaDataStateStore) {
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.security.Credentials

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.