Commit 20fb5894 by nixonrodrigues Committed by kevalbhatt

ATLAS-1546 : Fix for styleCheck error in Hive hook should choose appropriate…

ATLAS-1546 : Fix for styleCheck error in Hive hook should choose appropriate JAAS config if host uses kerberos ticket-cache
parent 6170063c
...@@ -26,6 +26,8 @@ import org.apache.hadoop.security.SecurityUtil; ...@@ -26,6 +26,8 @@ import org.apache.hadoop.security.SecurityUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.security.auth.login.AppConfigurationEntry;
import javax.security.auth.login.Configuration;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
...@@ -39,8 +41,6 @@ import java.util.SortedSet; ...@@ -39,8 +41,6 @@ import java.util.SortedSet;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.TreeSet; import java.util.TreeSet;
import javax.security.auth.login.AppConfigurationEntry;
import javax.security.auth.login.Configuration;
/** /**
* InMemoryJAASConfiguration * InMemoryJAASConfiguration
...@@ -127,7 +127,7 @@ public final class InMemoryJAASConfiguration extends Configuration { ...@@ -127,7 +127,7 @@ public final class InMemoryJAASConfiguration extends Configuration {
private static final String JAAS_CONFIG_LOGIN_MODULE_CONTROL_FLAG_PARAM = "loginModuleControlFlag"; private static final String JAAS_CONFIG_LOGIN_MODULE_CONTROL_FLAG_PARAM = "loginModuleControlFlag";
private static final String JAAS_CONFIG_LOGIN_OPTIONS_PREFIX = "option"; private static final String JAAS_CONFIG_LOGIN_OPTIONS_PREFIX = "option";
private static final String JAAS_PRINCIPAL_PROP = "principal"; private static final String JAAS_PRINCIPAL_PROP = "principal";
private static final Map<String, String> configSectionRedirects = new HashMap<>(); private static final Map<String, String> CONFIG_SECTION_REDIRECTS = new HashMap<>();
private Configuration parent = null; private Configuration parent = null;
private Map<String, List<AppConfigurationEntry>> applicationConfigEntryMap = new HashMap<>(); private Map<String, List<AppConfigurationEntry>> applicationConfigEntryMap = new HashMap<>();
...@@ -227,9 +227,9 @@ public final class InMemoryJAASConfiguration extends Configuration { ...@@ -227,9 +227,9 @@ public final class InMemoryJAASConfiguration extends Configuration {
ret = retList.toArray(ret); ret = retList.toArray(ret);
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("<== InMemoryJAASConfiguration.getAppConfigurationEntry({}): {}", name, ArrayUtils.toString(ret)); LOG.debug("<== InMemoryJAASConfiguration.getAppConfigurationEntry({}): {}", name, ArrayUtils.toString(ret));
} }
return ret; return ret;
} }
...@@ -245,11 +245,11 @@ public final class InMemoryJAASConfiguration extends Configuration { ...@@ -245,11 +245,11 @@ public final class InMemoryJAASConfiguration extends Configuration {
int prefixLen = JAAS_CONFIG_PREFIX_PARAM.length(); int prefixLen = JAAS_CONFIG_PREFIX_PARAM.length();
Map<String, SortedSet<Integer>> jaasClients = new HashMap<>(); Map<String, SortedSet<Integer>> jaasClients = new HashMap<>();
for(String key : properties.stringPropertyNames()) { for (String key : properties.stringPropertyNames()) {
if (key.startsWith(JAAS_CONFIG_PREFIX_PARAM)) { if (key.startsWith(JAAS_CONFIG_PREFIX_PARAM)) {
String jaasKey = key.substring(prefixLen); String jaasKey = key.substring(prefixLen);
StringTokenizer tokenizer = new StringTokenizer(jaasKey, "."); StringTokenizer tokenizer = new StringTokenizer(jaasKey, ".");
int tokenCount =tokenizer.countTokens(); int tokenCount = tokenizer.countTokens();
if (tokenCount > 0) { if (tokenCount > 0) {
String clientId = tokenizer.nextToken(); String clientId = tokenizer.nextToken();
SortedSet<Integer> indexList = jaasClients.get(clientId); SortedSet<Integer> indexList = jaasClients.get(clientId);
...@@ -259,7 +259,7 @@ public final class InMemoryJAASConfiguration extends Configuration { ...@@ -259,7 +259,7 @@ public final class InMemoryJAASConfiguration extends Configuration {
} }
String indexStr = tokenizer.nextToken(); String indexStr = tokenizer.nextToken();
int indexId = isNumeric(indexStr) ? Integer.parseInt(indexStr) : -1; int indexId = isNumeric(indexStr) ? Integer.parseInt(indexStr) : -1;
Integer clientIdIndex = Integer.valueOf(indexId); Integer clientIdIndex = Integer.valueOf(indexId);
...@@ -270,14 +270,14 @@ public final class InMemoryJAASConfiguration extends Configuration { ...@@ -270,14 +270,14 @@ public final class InMemoryJAASConfiguration extends Configuration {
} }
} }
} }
for(String jaasClient : jaasClients.keySet()) { for (String jaasClient : jaasClients.keySet()) {
for(Integer index : jaasClients.get(jaasClient)) { for (Integer index : jaasClients.get(jaasClient)) {
String keyPrefix = JAAS_CONFIG_PREFIX_PARAM + jaasClient + "."; String keyPrefix = JAAS_CONFIG_PREFIX_PARAM + jaasClient + ".";
if (index > -1) { if (index > -1) {
keyPrefix = keyPrefix + String.valueOf(index) + "."; keyPrefix = keyPrefix + String.valueOf(index) + ".";
} }
String keyParam = keyPrefix + JAAS_CONFIG_LOGIN_MODULE_NAME_PARAM; String keyParam = keyPrefix + JAAS_CONFIG_LOGIN_MODULE_NAME_PARAM;
...@@ -291,7 +291,7 @@ public final class InMemoryJAASConfiguration extends Configuration { ...@@ -291,7 +291,7 @@ public final class InMemoryJAASConfiguration extends Configuration {
} }
keyParam = keyPrefix + JAAS_CONFIG_LOGIN_MODULE_CONTROL_FLAG_PARAM; keyParam = keyPrefix + JAAS_CONFIG_LOGIN_MODULE_CONTROL_FLAG_PARAM;
String controlFlag = properties.getProperty(keyParam); String controlFlag = properties.getProperty(keyParam);
AppConfigurationEntry.LoginModuleControlFlag loginControlFlag = null; AppConfigurationEntry.LoginModuleControlFlag loginControlFlag = null;
if (controlFlag != null) { if (controlFlag != null) {
...@@ -322,9 +322,9 @@ public final class InMemoryJAASConfiguration extends Configuration { ...@@ -322,9 +322,9 @@ public final class InMemoryJAASConfiguration extends Configuration {
Map<String, String> options = new HashMap<>(); Map<String, String> options = new HashMap<>();
String optionPrefix = keyPrefix + JAAS_CONFIG_LOGIN_OPTIONS_PREFIX + "."; String optionPrefix = keyPrefix + JAAS_CONFIG_LOGIN_OPTIONS_PREFIX + ".";
int optionPrefixLen = optionPrefix.length(); int optionPrefixLen = optionPrefix.length();
for(String key : properties.stringPropertyNames()) { for (String key : properties.stringPropertyNames()) {
if (key.startsWith(optionPrefix)) { if (key.startsWith(optionPrefix)) {
String optionKey = key.substring(optionPrefixLen); String optionKey = key.substring(optionPrefixLen);
String optionVal = properties.getProperty(key); String optionVal = properties.getProperty(key);
...@@ -357,7 +357,7 @@ public final class InMemoryJAASConfiguration extends Configuration { ...@@ -357,7 +357,7 @@ public final class InMemoryJAASConfiguration extends Configuration {
LOG.debug(sb.toString()); LOG.debug(sb.toString());
} }
List<AppConfigurationEntry> retList = applicationConfigEntryMap.get(jaasClient); List<AppConfigurationEntry> retList = applicationConfigEntryMap.get(jaasClient);
if (retList == null) { if (retList == null) {
retList = new ArrayList<>(); retList = new ArrayList<>();
applicationConfigEntryMap.put(jaasClient, retList); applicationConfigEntryMap.put(jaasClient, retList);
...@@ -381,14 +381,14 @@ public final class InMemoryJAASConfiguration extends Configuration { ...@@ -381,14 +381,14 @@ public final class InMemoryJAASConfiguration extends Configuration {
if (name != null) { if (name != null) {
if (redirectTo != null) { if (redirectTo != null) {
configSectionRedirects.put(name, redirectTo); CONFIG_SECTION_REDIRECTS.put(name, redirectTo);
} else { } else {
configSectionRedirects.remove(name); CONFIG_SECTION_REDIRECTS.remove(name);
} }
} }
} }
private static String getConfigSectionRedirect(String name) { private static String getConfigSectionRedirect(String name) {
return name != null ? configSectionRedirects.get(name) : null; return name != null ? CONFIG_SECTION_REDIRECTS.get(name) : null;
} }
} }
...@@ -114,7 +114,7 @@ public abstract class AtlasHook { ...@@ -114,7 +114,7 @@ public abstract class AtlasHook {
* De-duping of entities is done on server side depending on the * De-duping of entities is done on server side depending on the
* unique attribute on the entities. * unique attribute on the entities.
* *
* @param messages hook notification messages * @param messages hook notification messages
* @param maxRetries maximum number of retries while sending message to messaging system * @param maxRetries maximum number of retries while sending message to messaging system
*/ */
public static void notifyEntities(List<HookNotification.HookNotificationMessage> messages, int maxRetries) { public static void notifyEntities(List<HookNotification.HookNotificationMessage> messages, int maxRetries) {
...@@ -142,7 +142,7 @@ public abstract class AtlasHook { ...@@ -142,7 +142,7 @@ public abstract class AtlasHook {
try { try {
LOG.debug("Sleeping for {} ms before retry", notificationRetryInterval); LOG.debug("Sleeping for {} ms before retry", notificationRetryInterval);
Thread.sleep(notificationRetryInterval); Thread.sleep(notificationRetryInterval);
} catch (InterruptedException ie){ } catch (InterruptedException ie) {
LOG.error("Notification hook thread sleep interrupted"); LOG.error("Notification hook thread sleep interrupted");
} }
...@@ -176,6 +176,7 @@ public abstract class AtlasHook { ...@@ -176,6 +176,7 @@ public abstract class AtlasHook {
/** /**
* Returns the logged in user. * Returns the logged in user.
*
* @return * @return
*/ */
public static String getUser() { public static String getUser() {
...@@ -223,7 +224,7 @@ public abstract class AtlasHook { ...@@ -223,7 +224,7 @@ public abstract class AtlasHook {
try { try {
ret = UserGroupInformation.isLoginKeytabBased(); ret = UserGroupInformation.isLoginKeytabBased();
} catch (Exception excp) { } catch (Exception excp) {
LOG.error("error in determining whether to use ticket-cache or keytab for KafkaClient JAAS configuration", excp); LOG.error("Error in determining keytab for KafkaClient-JAAS config", excp);
} }
return ret; return ret;
...@@ -235,7 +236,7 @@ public abstract class AtlasHook { ...@@ -235,7 +236,7 @@ public abstract class AtlasHook {
try { try {
ret = UserGroupInformation.isLoginTicketBased(); ret = UserGroupInformation.isLoginTicketBased();
} catch (Exception excp) { } catch (Exception excp) {
LOG.error("error in determining whether to use ticket-cache or keytab for KafkaClient JAAS configuration", excp); LOG.error("Error in determining ticket-cache for KafkaClient-JAAS config", excp);
} }
return ret; return ret;
......
...@@ -9,6 +9,10 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al ...@@ -9,6 +9,10 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai) ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES: ALL CHANGES:
ATLAS-1546 (ATLAS-1546.3.patch)Hive hook should choose appropriate JAAS config if host uses kerberos ticket-cache (nixonrodrigues via kevalbhat)
ATLAS-1503 Export/import support to copy data between Atlas instances (ashutoshm via mneethiraj)
ATLAS-1554 v2 EntityREST implementation for entity partial update (sarathkumarsubramanian via mneethiraj)
ATLAS-1547 Fix DeleteHandlerV1 for new model changes and add tests (mneethiraj)
ATLAS-1556 Edit entity button not working from search table of tag detail page. (kevalbhatt) ATLAS-1556 Edit entity button not working from search table of tag detail page. (kevalbhatt)
ATLAS-1559 Regression - If a new tag is created then the earlier tags doesn't render properly (kevalbhatt) ATLAS-1559 Regression - If a new tag is created then the earlier tags doesn't render properly (kevalbhatt)
ATLAS-1508 Make AtlasADAuthenticationProvider like Ranger ADLdap Methods (gss2002 via mneethiraj) ATLAS-1508 Make AtlasADAuthenticationProvider like Ranger ADLdap Methods (gss2002 via mneethiraj)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment