@Override public void obtainAuthTokenForJob(Configuration conf, Job job) throws IOException, InterruptedException { try { Class<?> c = Class.forName( "org.apache.hadoop.hbase.security.token.TokenUtil"); Methods.call(c, null, "obtainTokenForJob", new Class[]{Configuration.class, UserGroupInformation.class, Job.class}, new Object[]{conf, ugi, job}); } catch (ClassNotFoundException cnfe) { throw new RuntimeException("Failure loading TokenUtil class, " +"is secure RPC available?", cnfe); } catch (IOException ioe) { throw ioe; } catch (InterruptedException ie) { throw ie; } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new UndeclaredThrowableException(e, "Unexpected error calling TokenUtil.obtainAndCacheToken()"); } }
@Override public void obtainAuthTokenForJob(JobConf job) throws IOException, InterruptedException { try { Class<?> c = Class.forName( "org.apache.hadoop.hbase.security.token.TokenUtil"); Methods.call(c, null, "obtainTokenForJob", new Class[]{JobConf.class, UserGroupInformation.class}, new Object[]{job, ugi}); } catch (ClassNotFoundException cnfe) { throw new RuntimeException("Failure loading TokenUtil class, " +"is secure RPC available?", cnfe); } catch (IOException ioe) { throw ioe; } catch (InterruptedException ie) { throw ie; } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new UndeclaredThrowableException(e, "Unexpected error calling TokenUtil.obtainAndCacheToken()"); } }
@Override public void obtainAuthTokenForJob(Configuration conf, Job job) throws IOException, InterruptedException { try { Class c = Class.forName( "org.apache.hadoop.hbase.security.token.TokenUtil"); Methods.call(c, null, "obtainTokenForJob", new Class[]{Configuration.class, UserGroupInformation.class, Job.class}, new Object[]{conf, ugi, job}); } catch (ClassNotFoundException cnfe) { throw new RuntimeException("Failure loading TokenUtil class, " +"is secure RPC available?", cnfe); } catch (IOException ioe) { throw ioe; } catch (InterruptedException ie) { throw ie; } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new UndeclaredThrowableException(e, "Unexpected error calling TokenUtil.obtainAndCacheToken()"); } }
@Override public void obtainAuthTokenForJob(JobConf job) throws IOException, InterruptedException { try { Class c = Class.forName( "org.apache.hadoop.hbase.security.token.TokenUtil"); Methods.call(c, null, "obtainTokenForJob", new Class[]{JobConf.class, UserGroupInformation.class}, new Object[]{job, ugi}); } catch (ClassNotFoundException cnfe) { throw new RuntimeException("Failure loading TokenUtil class, " +"is secure RPC available?", cnfe); } catch (IOException ioe) { throw ioe; } catch (InterruptedException ie) { throw ie; } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new UndeclaredThrowableException(e, "Unexpected error calling TokenUtil.obtainAndCacheToken()"); } }
/** * Obtain credentials for the current process using the configured * Kerberos keytab file and principal. * @see User#login(org.apache.hadoop.conf.Configuration, String, String, String) * * @param conf the Configuration to use * @param fileConfKey Configuration property key used to store the path * to the keytab file * @param principalConfKey Configuration property key used to store the * principal name to login as * @param localhost the local hostname */ public static void login(Configuration conf, String fileConfKey, String principalConfKey, String localhost) throws IOException { if (isSecurityEnabled()) { // check for SecurityUtil class try { Class c = Class.forName("org.apache.hadoop.security.SecurityUtil"); Class[] types = new Class[]{ Configuration.class, String.class, String.class, String.class }; Object[] args = new Object[]{ conf, fileConfKey, principalConfKey, localhost }; Methods.call(c, null, "login", types, args); } catch (ClassNotFoundException cnfe) { throw new RuntimeException("Unable to login using " + "org.apache.hadoop.security.SecurityUtil.login(). SecurityUtil class " + "was not found! Is this a version of secure Hadoop?", cnfe); } catch (IOException ioe) { throw ioe; } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new UndeclaredThrowableException(e, "Unhandled exception in User.login()"); } } }
/** * Executes the given action as the login user * @param action * @return the result of the action * @throws IOException */ @SuppressWarnings({ "rawtypes", "unchecked" }) public static <T> T runAsLoginUser(PrivilegedExceptionAction<T> action) throws IOException { try { Class c = Class.forName("org.apache.hadoop.security.SecurityUtil"); Class [] types = new Class[]{PrivilegedExceptionAction.class}; Object[] args = new Object[]{action}; return (T) Methods.call(c, null, "doAsLoginUser", types, args); } catch (Throwable e) { throw new IOException(e); } }
public String prepareBulkLoad(byte[] tableName) throws IOException { try { String bulkToken = (String) Methods.call(protocolClazz, proxy, "prepareBulkLoad", new Class[]{byte[].class}, new Object[]{tableName}); return bulkToken; } catch (Exception e) { throw new IOException("Failed to prepareBulkLoad", e); } }
public void cleanupBulkLoad(String bulkToken) throws IOException { try { Methods.call(protocolClazz, proxy, "cleanupBulkLoad", new Class[]{String.class},new Object[]{bulkToken}); } catch (Exception e) { throw new IOException("Failed to prepareBulkLoad", e); } }