|
@@ -206,8 +206,6 @@ public class UserGroupInformation {
|
|
|
|
|
|
private final Subject subject;
|
|
|
|
|
|
- private LoginContext login;
|
|
|
-
|
|
|
private static final String OS_LOGIN_MODULE_NAME;
|
|
|
private static final Class<? extends Principal> OS_PRINCIPAL_CLASS;
|
|
|
private static final boolean windows =
|
|
@@ -330,6 +328,19 @@ public class UserGroupInformation {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private LoginContext getLogin() {
|
|
|
+ for (User p: subject.getPrincipals(User.class)) {
|
|
|
+ return p.getLogin();
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setLogin(LoginContext login) {
|
|
|
+ for (User p: subject.getPrincipals(User.class)) {
|
|
|
+ p.setLogin(login);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* Create a UserGroupInformation for the given subject.
|
|
@@ -371,7 +382,7 @@ public class UserGroupInformation {
|
|
|
subject);
|
|
|
}
|
|
|
login.login();
|
|
|
- loginUser.login = login;
|
|
|
+ loginUser.setLogin(login);
|
|
|
loginUser = new UserGroupInformation(login.getSubject());
|
|
|
String tokenFile = System.getenv(HADOOP_TOKEN_FILE_LOCATION);
|
|
|
if (tokenFile != null && isSecurityEnabled()) {
|
|
@@ -407,7 +418,7 @@ public class UserGroupInformation {
|
|
|
new LoginContext(HadoopConfiguration.KEYTAB_KERBEROS_CONFIG_NAME, subject);
|
|
|
login.login();
|
|
|
loginUser = new UserGroupInformation(subject);
|
|
|
- loginUser.login = login;
|
|
|
+ loginUser.setLogin(login);
|
|
|
} catch (LoginException le) {
|
|
|
throw new IOException("Login failure for " + user + " from keytab " +
|
|
|
path, le);
|
|
@@ -427,6 +438,7 @@ public class UserGroupInformation {
|
|
|
throws IOException {
|
|
|
if (!isSecurityEnabled())
|
|
|
return;
|
|
|
+ LoginContext login = getLogin();
|
|
|
if (login == null || keytabFile == null) {
|
|
|
throw new IOException("loginUserFromKeyTab must be done first");
|
|
|
}
|
|
@@ -452,6 +464,7 @@ public class UserGroupInformation {
|
|
|
getSubject());
|
|
|
LOG.info("Initiating re-login for " + keytabPrincipal);
|
|
|
login.login();
|
|
|
+ setLogin(login);
|
|
|
} catch (LoginException le) {
|
|
|
throw new IOException("Login failure for " + keytabPrincipal +
|
|
|
" from keytab " + keytabFile, le);
|