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;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.security.auth.login.AppConfigurationEntry;
import javax.security.auth.login.Configuration;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
......@@ -39,8 +41,6 @@ import java.util.SortedSet;
import java.util.StringTokenizer;
import java.util.TreeSet;
import javax.security.auth.login.AppConfigurationEntry;
import javax.security.auth.login.Configuration;
/**
* InMemoryJAASConfiguration
......@@ -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_OPTIONS_PREFIX = "option";
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 Map<String, List<AppConfigurationEntry>> applicationConfigEntryMap = new HashMap<>();
......@@ -245,11 +245,11 @@ public final class InMemoryJAASConfiguration extends Configuration {
int prefixLen = JAAS_CONFIG_PREFIX_PARAM.length();
Map<String, SortedSet<Integer>> jaasClients = new HashMap<>();
for(String key : properties.stringPropertyNames()) {
for (String key : properties.stringPropertyNames()) {
if (key.startsWith(JAAS_CONFIG_PREFIX_PARAM)) {
String jaasKey = key.substring(prefixLen);
StringTokenizer tokenizer = new StringTokenizer(jaasKey, ".");
int tokenCount =tokenizer.countTokens();
int tokenCount = tokenizer.countTokens();
if (tokenCount > 0) {
String clientId = tokenizer.nextToken();
SortedSet<Integer> indexList = jaasClients.get(clientId);
......@@ -270,9 +270,9 @@ 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 + ".";
......@@ -324,7 +324,7 @@ public final class InMemoryJAASConfiguration extends Configuration {
Map<String, String> options = new HashMap<>();
String optionPrefix = keyPrefix + JAAS_CONFIG_LOGIN_OPTIONS_PREFIX + ".";
int optionPrefixLen = optionPrefix.length();
for(String key : properties.stringPropertyNames()) {
for (String key : properties.stringPropertyNames()) {
if (key.startsWith(optionPrefix)) {
String optionKey = key.substring(optionPrefixLen);
String optionVal = properties.getProperty(key);
......@@ -381,14 +381,14 @@ public final class InMemoryJAASConfiguration extends Configuration {
if (name != null) {
if (redirectTo != null) {
configSectionRedirects.put(name, redirectTo);
CONFIG_SECTION_REDIRECTS.put(name, redirectTo);
} else {
configSectionRedirects.remove(name);
CONFIG_SECTION_REDIRECTS.remove(name);
}
}
}
private static String getConfigSectionRedirect(String name) {
return name != null ? configSectionRedirects.get(name) : null;
return name != null ? CONFIG_SECTION_REDIRECTS.get(name) : null;
}
}
......@@ -142,7 +142,7 @@ public abstract class AtlasHook {
try {
LOG.debug("Sleeping for {} ms before retry", notificationRetryInterval);
Thread.sleep(notificationRetryInterval);
} catch (InterruptedException ie){
} catch (InterruptedException ie) {
LOG.error("Notification hook thread sleep interrupted");
}
......@@ -176,6 +176,7 @@ public abstract class AtlasHook {
/**
* Returns the logged in user.
*
* @return
*/
public static String getUser() {
......@@ -223,7 +224,7 @@ public abstract class AtlasHook {
try {
ret = UserGroupInformation.isLoginKeytabBased();
} 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;
......@@ -235,7 +236,7 @@ public abstract class AtlasHook {
try {
ret = UserGroupInformation.isLoginTicketBased();
} 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;
......
......@@ -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)
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-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)
......
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