HADOOP-6520. Adds APIs to read/write Token and secret keys. Also adds the automatic loading of tokens into UserGroupInformation upon login. The tokens are read from a file specified in the environment variable. Contributed by Devaraj Das.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@904861 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
611340714b
commit
ba8647f511
@ -43,6 +43,11 @@ Trunk (unreleased changes)
|
||||
|
||||
HADOOP-6464. Write a Rackspace cloud provider. (tomwhite)
|
||||
|
||||
HADOOP-6520. Adds APIs to read/write Token and secret keys. Also
|
||||
adds the automatic loading of tokens into UserGroupInformation
|
||||
upon login. The tokens are read from a file specified in the
|
||||
environment variable. (ddas)
|
||||
|
||||
IMPROVEMENTS
|
||||
|
||||
HADOOP-6283. Improve the exception messages thrown by
|
||||
|
@ -34,7 +34,6 @@
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@ -132,6 +131,10 @@ public boolean logout() throws LoginException {
|
||||
/** Server-side groups fetching service */
|
||||
private static Groups groups;
|
||||
|
||||
/**Environment variable pointing to the token cache file*/
|
||||
public static final String HADOOP_TOKEN_FILE_LOCATION =
|
||||
"HADOOP_TOKEN_FILE_LOCATION";
|
||||
|
||||
/**
|
||||
* A method to initialize the fields that depend on a configuration.
|
||||
* Must be called before useKerberos or groups is used.
|
||||
@ -317,6 +320,10 @@ static UserGroupInformation getLoginUser() throws IOException {
|
||||
}
|
||||
login.login();
|
||||
loginUser = new UserGroupInformation(login.getSubject());
|
||||
String tokenFile = System.getenv(HADOOP_TOKEN_FILE_LOCATION);
|
||||
if (tokenFile != null && isSecurityEnabled()) {
|
||||
TokenStorage.readTokensAndLoadInUGI(tokenFile, new Configuration(), loginUser);
|
||||
}
|
||||
} catch (LoginException le) {
|
||||
throw new IOException("failure to login", le);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user