|
@@ -69,6 +69,7 @@ public class UserGroupInformation {
|
|
*/
|
|
*/
|
|
private static final float TICKET_RENEW_WINDOW = 0.80f;
|
|
private static final float TICKET_RENEW_WINDOW = 0.80f;
|
|
static final String HADOOP_USER_NAME = "HADOOP_USER_NAME";
|
|
static final String HADOOP_USER_NAME = "HADOOP_USER_NAME";
|
|
|
|
+ static final String HADOOP_PROXY_USER = "HADOOP_PROXY_USER";
|
|
|
|
|
|
/**
|
|
/**
|
|
* A login module that looks at the Kerberos, Unix, or Windows principal and
|
|
* A login module that looks at the Kerberos, Unix, or Windows principal and
|
|
@@ -484,12 +485,20 @@ public class UserGroupInformation {
|
|
login = newLoginContext(HadoopConfiguration.SIMPLE_CONFIG_NAME, subject);
|
|
login = newLoginContext(HadoopConfiguration.SIMPLE_CONFIG_NAME, subject);
|
|
}
|
|
}
|
|
login.login();
|
|
login.login();
|
|
- loginUser = new UserGroupInformation(subject);
|
|
|
|
- loginUser.setLogin(login);
|
|
|
|
- loginUser.setAuthenticationMethod(isSecurityEnabled() ?
|
|
|
|
|
|
+ UserGroupInformation realUser = new UserGroupInformation(subject);
|
|
|
|
+ realUser.setLogin(login);
|
|
|
|
+ realUser.setAuthenticationMethod(isSecurityEnabled() ?
|
|
AuthenticationMethod.KERBEROS :
|
|
AuthenticationMethod.KERBEROS :
|
|
AuthenticationMethod.SIMPLE);
|
|
AuthenticationMethod.SIMPLE);
|
|
- loginUser = new UserGroupInformation(login.getSubject());
|
|
|
|
|
|
+ realUser = new UserGroupInformation(login.getSubject());
|
|
|
|
+ // If the HADOOP_PROXY_USER environment variable or property
|
|
|
|
+ // is specified, create a proxy user as the logged in user.
|
|
|
|
+ String proxyUser = System.getenv(HADOOP_PROXY_USER);
|
|
|
|
+ if (proxyUser == null) {
|
|
|
|
+ proxyUser = System.getProperty(HADOOP_PROXY_USER);
|
|
|
|
+ }
|
|
|
|
+ loginUser = proxyUser == null ? realUser : createProxyUser(proxyUser, realUser);
|
|
|
|
+
|
|
String fileLocation = System.getenv(HADOOP_TOKEN_FILE_LOCATION);
|
|
String fileLocation = System.getenv(HADOOP_TOKEN_FILE_LOCATION);
|
|
if (fileLocation != null && isSecurityEnabled()) {
|
|
if (fileLocation != null && isSecurityEnabled()) {
|
|
// load the token storage file and put all of the tokens into the
|
|
// load the token storage file and put all of the tokens into the
|