mirror of
https://github.com/apache/sqoop.git
synced 2025-05-04 05:51:17 +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 {
|
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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user