5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-04 03:29:26 +08:00

SQOOP-1246: HBaseImportJob should add job authtoken only if HBase is secured

(Aditya Kishore via Jarek Jarcec Cecho)
This commit is contained in:
Jarek Jarcec Cecho 2013-12-04 10:05:29 -08:00
parent 5f7013eae1
commit e98075976b

View File

@ -165,7 +165,8 @@ protected void jobSetup(Job job) throws IOException, ImportException {
*/ */
try { try {
// Get method isSecurityEnabled // Get method isSecurityEnabled
Method isSecurityEnabled = User.class.getMethod("isSecurityEnabled"); Method isHBaseSecurityEnabled = User.class.getMethod(
"isHBaseSecurityEnabled", Configuration.class);
// Get method obtainAuthTokenForJob // Get method obtainAuthTokenForJob
Method obtainAuthTokenForJob = User.class.getMethod( Method obtainAuthTokenForJob = User.class.getMethod(
@ -175,7 +176,7 @@ protected void jobSetup(Job job) throws IOException, ImportException {
User user = User.getCurrent(); User user = User.getCurrent();
// Obtain security token if needed // Obtain security token if needed
if ((Boolean)isSecurityEnabled.invoke(null)) { if ((Boolean)isHBaseSecurityEnabled.invoke(null, conf)) {
obtainAuthTokenForJob.invoke(user, conf, job); obtainAuthTokenForJob.invoke(user, conf, job);
} }
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {