mirror of
https://github.com/apache/sqoop.git
synced 2025-05-03 02:32:23 +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:
parent
5f7013eae1
commit
e98075976b
@ -165,7 +165,8 @@ protected void jobSetup(Job job) throws IOException, ImportException {
|
||||
*/
|
||||
try {
|
||||
// Get method isSecurityEnabled
|
||||
Method isSecurityEnabled = User.class.getMethod("isSecurityEnabled");
|
||||
Method isHBaseSecurityEnabled = User.class.getMethod(
|
||||
"isHBaseSecurityEnabled", Configuration.class);
|
||||
|
||||
// Get method obtainAuthTokenForJob
|
||||
Method obtainAuthTokenForJob = User.class.getMethod(
|
||||
@ -175,7 +176,7 @@ protected void jobSetup(Job job) throws IOException, ImportException {
|
||||
User user = User.getCurrent();
|
||||
|
||||
// Obtain security token if needed
|
||||
if ((Boolean)isSecurityEnabled.invoke(null)) {
|
||||
if ((Boolean)isHBaseSecurityEnabled.invoke(null, conf)) {
|
||||
obtainAuthTokenForJob.invoke(user, conf, job);
|
||||
}
|
||||
} catch (NoSuchMethodException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user