/** * Gets the serialized token class from either the configuration or the token file. * * @since 1.5.0 * @deprecated since 1.6.0; Use {@link #getAuthenticationToken(JobConf)} instead. */ @Deprecated protected static String getTokenClass(JobConf job) { return getAuthenticationToken(job).getClass().getName(); }
/** * Gets the serialized token from either the configuration or the token file. * * @since 1.5.0 * @deprecated since 1.6.0; Use {@link #getAuthenticationToken(JobConf)} instead. */ @Deprecated protected static byte[] getToken(JobConf job) { return AuthenticationTokenSerializer.serialize(getAuthenticationToken(job)); }
@Override public void checkOutputSpecs(FileSystem ignored, JobConf job) throws IOException { if (!isConnectorInfoSet(job)) throw new IOException("Connector info has not been set."); try { AccumuloClient c = OutputConfigurator.client(CLASS, job); String principal = getPrincipal(job); AuthenticationToken token = getAuthenticationToken(job); if (!c.securityOperations().authenticateUser(principal, token)) throw new IOException("Unable to authenticate user"); } catch (AccumuloException | AccumuloSecurityException e) { throw new IOException(e); } }
/** * Gets the serialized token class from either the configuration or the token file. * * @since 1.5.0 * @deprecated since 1.6.0; Use {@link #getAuthenticationToken(JobConf)} instead. */ @Deprecated protected static String getTokenClass(JobConf job) { return getAuthenticationToken(job).getClass().getName(); }
/** * Gets the serialized token from either the configuration or the token file. * * @since 1.5.0 * @deprecated since 1.6.0; Use {@link #getAuthenticationToken(JobConf)} instead. */ @Deprecated protected static byte[] getToken(JobConf job) { return AuthenticationTokenSerializer.serialize(getAuthenticationToken(job)); }
@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); } }
@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 AccumuloClient c = Accumulo.newClient().usingClientInfo(getClientInfo(job)).build(); String principal = getPrincipal(job); AuthenticationToken token = getAuthenticationToken(job); if (!c.securityOperations().authenticateUser(principal, token)) throw new IOException("Unable to authenticate user"); } catch (AccumuloException | 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)); } }