@Override public void checkOutputSpecs(FileSystem ignored, JobConf job) throws IOException { if (!isConnectorInfoSet(job)) throw new IOException("Connector info has not been set."); try { // if the instance isn't configured, it will complain here String principal = getPrincipal(job); AuthenticationToken token = getAuthenticationToken(job); Connector c = getInstance(job).getConnector(principal, token); if (!c.securityOperations().authenticateUser(principal, token)) throw new IOException("Unable to authenticate user"); } catch (AccumuloException e) { throw new IOException(e); } catch (AccumuloSecurityException e) { throw new IOException(e); } }
protected AccumuloRecordWriter(JobConf job) throws AccumuloException, AccumuloSecurityException, IOException { Level l = getLogLevel(job); if (l != null) log.setLevel(getLogLevel(job)); this.simulate = getSimulationMode(job); this.createTables = canCreateTables(job); if (simulate) log.info("Simulating output only. No writes to tables will occur"); this.bws = new HashMap<>(); String tname = getDefaultTableName(job); this.defaultTableName = (tname == null) ? null : new Text(tname); if (!simulate) { this.conn = getInstance(job).getConnector(getPrincipal(job), getAuthenticationToken(job)); mtbw = conn.createMultiTableBatchWriter(getBatchWriterOptions(job)); } }
log.info("Received KerberosToken, attempting to fetch DelegationToken"); try { Instance instance = getInstance(job); Connector conn = instance.getConnector(principal, token); token = conn.securityOperations().getDelegationToken(new DelegationTokenConfig());