azkaban-aplcache

Proposing CredentialProvider interface (#1552) Creating

11/7/2017 5:30:49 PM
3.38.0

Details

diff --git a/az-core/src/main/java/azkaban/Constants.java b/az-core/src/main/java/azkaban/Constants.java
index b3f4851..4424c15 100644
--- a/az-core/src/main/java/azkaban/Constants.java
+++ b/az-core/src/main/java/azkaban/Constants.java
@@ -167,6 +167,8 @@ public class Constants {
 
     // enable Quartz Scheduler if true.
     public static final String ENABLE_QUARTZ= "azkaban.server.schedule.enable_quartz";
+
+    public static final String CUSTOM_CREDENTIAL_NAME = "azkaban.security.credential";
   }
 
   public static class FlowProperties {
diff --git a/azkaban-hadoop-security-plugin/src/main/java/azkaban/security/CredentialProvider.java b/azkaban-hadoop-security-plugin/src/main/java/azkaban/security/CredentialProvider.java
new file mode 100644
index 0000000..1a6c2c9
--- /dev/null
+++ b/azkaban-hadoop-security-plugin/src/main/java/azkaban/security/CredentialProvider.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2017 LinkedIn Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
+
+package azkaban.security;
+
+/**
+ * Fetch and inject user secret key into custom credential object.
+ */
+public interface CredentialProvider {
+
+  /**
+   * register custom secret keys on behalf of an user into credentials.
+   *
+   * @param user find out the user's credential and register it.
+   */
+  public void register(String user);
+}
diff --git a/azkaban-hadoop-security-plugin/src/main/java/azkaban/security/HadoopSecurityManager_H_2_0.java b/azkaban-hadoop-security-plugin/src/main/java/azkaban/security/HadoopSecurityManager_H_2_0.java
index e2ed7f9..192484e 100644
--- a/azkaban-hadoop-security-plugin/src/main/java/azkaban/security/HadoopSecurityManager_H_2_0.java
+++ b/azkaban-hadoop-security-plugin/src/main/java/azkaban/security/HadoopSecurityManager_H_2_0.java
@@ -802,20 +802,21 @@ public class HadoopSecurityManager_H_2_0 extends HadoopSecurityManager {
   /**
    * Method to create a metastore client that retries on failures
    */
-  private IMetaStoreClient createRetryingMetaStoreClient(HiveConf hiveConf) throws MetaException {
+  private IMetaStoreClient createRetryingMetaStoreClient(final HiveConf hiveConf)
+      throws MetaException {
     // Custom hook-loader to return a HiveMetaHook if the table is configured with a custom storage handler
-    HiveMetaHookLoader hookLoader = new HiveMetaHookLoader() {
+    final HiveMetaHookLoader hookLoader = new HiveMetaHookLoader() {
       @Override
-      public HiveMetaHook getHook(Table tbl) throws MetaException {
+      public HiveMetaHook getHook(final Table tbl) throws MetaException {
         if (tbl == null) {
           return null;
         }
 
         try {
-          HiveStorageHandler storageHandler =
+          final HiveStorageHandler storageHandler =
               HiveUtils.getStorageHandler(hiveConf, tbl.getParameters().get(META_TABLE_STORAGE));
           return storageHandler == null ? null : storageHandler.getMetaHook();
-        } catch (HiveException e) {
+        } catch (final HiveException e) {
           logger.error(e.toString());
           throw new MetaException("Failed to get storage handler: " + e);
         }