@Override public AuthenticationToken getAuthenticationToken() { if (token == null) { token = ClientProperty.getAuthenticationToken(properties); } return token; }
public AuthenticationToken getToken() { return ClientProperty.getAuthenticationToken(getClientProperties()); }
if (password == null && clientProperties.containsKey(ClientProperty.AUTH_TOKEN.getKey()) && principal.equals(ClientProperty.AUTH_PRINCIPAL.getValue(clientProperties))) { token = ClientProperty.getAuthenticationToken(clientProperties);
/** * Gets the authenticated token from either the specified token file or directly from the * configuration, whichever was used when the job was configured. * * @param implementingClass * the class whose name will be used as a prefix for the property configuration key * @param conf * the Hadoop configuration object to configure * @return the principal's authentication token * @since 1.6.0 * @see #setConnectorInfo(Class, Configuration, String, AuthenticationToken) */ public static AuthenticationToken getAuthenticationToken(Class<?> implementingClass, Configuration conf) { Properties props = getClientProperties(implementingClass, conf); return ClientProperty.getAuthenticationToken(props); }
@Override public void checkOutputSpecs(JobContext job) throws IOException { Properties clientProps = OutputConfigurator.getClientProperties(CLASS, job.getConfiguration()); AuthenticationToken token = ClientProperty.getAuthenticationToken(clientProps); try (AccumuloClient c = Accumulo.newClient().from(clientProps).build()) { if (!c.securityOperations().authenticateUser(c.whoami(), token)) throw new IOException("Unable to authenticate user"); } catch (AccumuloException | AccumuloSecurityException e) { throw new IOException(e); } }
@Override public void checkOutputSpecs(FileSystem ignored, JobConf job) throws IOException { Properties clientProps = OutputConfigurator.getClientProperties(CLASS, job); AuthenticationToken token = ClientProperty.getAuthenticationToken(clientProps); try (AccumuloClient c = Accumulo.newClient().from(clientProps).build()) { if (!c.securityOperations().authenticateUser(c.whoami(), token)) throw new IOException("Unable to authenticate user"); } catch (AccumuloException | AccumuloSecurityException e) { throw new IOException(e); } }