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

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


      if (extent.isRootTablet()) {
        throw new IllegalArgumentException("Can not import files to root tablet");
      }

      synchronized (bulkFileImportLock) {
        TCredentials auths = SecurityConstants.getSystemCredentials();
        Connector conn;
        try {
          conn = HdfsZooInstance.getInstance().getConnector(auths.getPrincipal(), CredentialHelper.extractToken(auths));
        } catch (Exception ex) {
          throw new IOException(ex);
        }
        // Remove any bulk files we've previously loaded and compacted away
        List<String> files = MetadataTable.getBulkFilesLoaded(conn, extent, tid);
View Full Code Here


      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... the minor compaction start even should be written before the following metadata
        // write is made
        TCredentials creds = SecurityConstants.getSystemCredentials();
       
        synchronized (timeLock) {
          if (commitSession.getMaxCommittedTime() > persistedTime)
            persistedTime = commitSession.getMaxCommittedTime();
         
View Full Code Here

        } else
          initiateMinor = true;
      }
     
      if (updateMetadata) {
        TCredentials creds = SecurityConstants.getSystemCredentials();
        // if multiple threads were allowed to update this outside of a sync block, then it would be
        // a race condition
        MetadataTable.updateTabletFlushID(extent, tableFlushID, creds, tabletServer.getLock());
      } else if (initiateMinor)
        initiateMinorCompaction(tableFlushID, MinorCompactionReason.USER);
View Full Code Here

          log.error("Failed to add log recovery watcher back", e);
        }
      }
    });
   
    TCredentials systemAuths = SecurityConstants.getSystemCredentials();
    final TabletStateStore stores[] = {
        new ZooTabletStateStore(new ZooStore(zroot)),
        new RootTabletStateStore(instance, systemAuths, this),
        new MetaDataStateStore(instance, systemAuths, this)
    };
View Full Code Here

 
  @Test
  public void testToThrift() throws DestroyFailedException {
    // verify thrift serialization
    Credentials creds = new Credentials("test", new PasswordToken("testing"));
    TCredentials tCreds = creds.toThrift(new MockInstance());
    assertEquals("test", tCreds.getPrincipal());
    assertEquals(PasswordToken.class.getName(), tCreds.getTokenClassName());
    assertArrayEquals(AuthenticationTokenSerializer.serialize(new PasswordToken("testing")), tCreds.getToken());
   
    // verify that we can't serialize if it's destroyed
    creds.getToken().destroy();
    try {
      creds.toThrift(new MockInstance());
View Full Code Here

  }

  @Test
  public void roundtripThrift() throws DestroyFailedException {
    Credentials creds = new Credentials("test", new PasswordToken("testing"));
    TCredentials tCreds = creds.toThrift(new MockInstance());
    Credentials roundtrip = Credentials.fromThrift(tCreds);
    assertEquals("Roundtrip through thirft changed credentials equality", creds, roundtrip);
  }
View Full Code Here

   * @return Thrift credentials
   * @throws RuntimeException
   *           if the authentication token has been destroyed (expired)
   */
  public TCredentials toThrift(Instance instance) {
    TCredentials tCreds = new TCredentials(getPrincipal(), getToken().getClass().getName(),
        ByteBuffer.wrap(AuthenticationTokenSerializer.serialize(getToken())), instance.getInstanceID());
    if (getToken().isDestroyed())
      throw new RuntimeException("Token has been destroyed", new AccumuloSecurityException(getPrincipal(), SecurityErrorCode.TOKEN_EXPIRED));
    return tCreds;
  }
View Full Code Here

TOP

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

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.