try { ClientContext client = OutputConfigurator.client(CLASS, job.getConfiguration()); token = client.securityOperations().getDelegationToken(new DelegationTokenConfig()); } catch (Exception e) { log.warn("Failed to automatically obtain DelegationToken, "
/** * Serialize the delegation token config into the thrift variant * * @param config * The configuration */ public static TDelegationTokenConfig serialize(DelegationTokenConfig config) { TDelegationTokenConfig tconfig = new TDelegationTokenConfig(); tconfig.setLifetime(config.getTokenLifetime(TimeUnit.MILLISECONDS)); return tconfig; }
/** * Deserialize the Thrift delegation token config into the non-thrift variant * * @param tconfig * The thrift configuration */ public static DelegationTokenConfig deserialize(TDelegationTokenConfig tconfig) { DelegationTokenConfig config = new DelegationTokenConfig(); if (tconfig.isSetLifetime()) { config.setTokenLifetime(tconfig.getLifetime(), TimeUnit.MILLISECONDS); } return config; } }
try { ClientContext client = InputConfigurator.client(CLASS, job.getConfiguration()); token = client.securityOperations().getDelegationToken(new DelegationTokenConfig()); } catch (Exception e) { log.warn("Failed to automatically obtain DelegationToken, "
/** * Deserialize the Thrift delegation token config into the non-thrift variant * * @param tconfig * The thrift configuration */ public static DelegationTokenConfig deserialize(TDelegationTokenConfig tconfig) { DelegationTokenConfig config = new DelegationTokenConfig(); if (tconfig.isSetLifetime()) { config.setTokenLifetime(tconfig.getLifetime(), TimeUnit.MILLISECONDS); } return config; } }
long requestedLifetime = cfg.getTokenLifetime(TimeUnit.MILLISECONDS); if (requestedLifetime > 0) { long requestedExpirationDate = identifier.getIssueDate() + requestedLifetime;
try { ClientContext client = OutputConfigurator.client(CLASS, job); token = client.securityOperations().getDelegationToken(new DelegationTokenConfig()); } catch (Exception e) { log.warn("Failed to automatically obtain DelegationToken, "
@Override public AuthenticationToken run() throws Exception { Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken()); log.info("Created connector as {}", rootUser.getPrincipal()); assertEquals(rootUser.getPrincipal(), conn.whoami()); // Should fail return conn.securityOperations().getDelegationToken( new DelegationTokenConfig().setTokenLifetime(Long.MAX_VALUE, TimeUnit.MILLISECONDS)); } });
/** * Serialize the delegation token config into the thrift variant * * @param config * The configuration */ public static TDelegationTokenConfig serialize(DelegationTokenConfig config) { TDelegationTokenConfig tconfig = new TDelegationTokenConfig(); tconfig.setLifetime(config.getTokenLifetime(TimeUnit.MILLISECONDS)); return tconfig; }
try { ClientContext client = InputConfigurator.client(CLASS, job); token = client.securityOperations().getDelegationToken(new DelegationTokenConfig()); } catch (Exception e) { log.warn("Failed to automatically obtain DelegationToken, Mappers/Reducers will likely"
@Override public AuthenticationToken run() throws Exception { Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken()); log.info("Created connector as {}", rootUser.getPrincipal()); assertEquals(rootUser.getPrincipal(), conn.whoami()); return conn.securityOperations() .getDelegationToken(new DelegationTokenConfig().setTokenLifetime(5, TimeUnit.MINUTES)); } });
long requestedLifetime = cfg.getTokenLifetime(TimeUnit.MILLISECONDS); if (0 < requestedLifetime) { long requestedExpirationDate = identifier.getIssueDate() + requestedLifetime;
/** * Obtain a DelegationToken from Accumulo. * * @param conn * The Accumulo connector * @return The DelegationToken instance * @throws IOException * If the token cannot be obtained */ public AuthenticationToken getDelegationToken(Connector conn) throws IOException { try { DelegationTokenConfig config = new DelegationTokenConfig(); return conn.securityOperations().getDelegationToken(config); } catch (AccumuloException | AccumuloSecurityException e) { throw new IOException("Failed to obtain DelegationToken", e); } }
@Override public Void run() throws Exception { // As the "root" user, open up the connection and get a delegation token Connector conn = mac.getConnector(qualifiedNewUser, new KerberosToken()); log.info("Created connector as {}", qualifiedNewUser); assertEquals(qualifiedNewUser, conn.whoami()); conn.securityOperations().getDelegationToken(new DelegationTokenConfig()); return null; } });
return conn.securityOperations().getDelegationToken(new DelegationTokenConfig()); } catch (Exception e) { final String msg = "Failed to acquire DelegationToken for use with MapReduce";
return client.securityOperations().getDelegationToken(new DelegationTokenConfig()); } catch (Exception e) { final String msg = "Failed to acquire DelegationToken for use with MapReduce";
return client.securityOperations().getDelegationToken(new DelegationTokenConfig());
@Override public AuthenticationToken run() throws Exception { // As the "root" user, open up the connection and get a delegation token Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken()); log.info("Created connector as {}", rootUser.getPrincipal()); assertEquals(rootUser.getPrincipal(), conn.whoami()); return conn.securityOperations().getDelegationToken(new DelegationTokenConfig()); } });
token = conn.securityOperations().getDelegationToken(new DelegationTokenConfig());
.getDelegationToken(new DelegationTokenConfig());