svn merge -c 1552104 FIXES: HADOOP-10164. Allow UGI to login with a known Subject (bobby)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1552106 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0cf92b66c5
commit
971418cdb5
|
@ -107,6 +107,8 @@ Release 2.4.0 - UNRELEASED
|
||||||
|
|
||||||
HADOOP-10168. fix javadoc of ReflectionUtils#copy. (Thejas Nair via suresh)
|
HADOOP-10168. fix javadoc of ReflectionUtils#copy. (Thejas Nair via suresh)
|
||||||
|
|
||||||
|
HADOOP-10164. Allow UGI to login with a known Subject (bobby)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HADOOP-9748. Reduce blocking on UGI.ensureInitialized (daryn)
|
HADOOP-9748. Reduce blocking on UGI.ensureInitialized (daryn)
|
||||||
|
|
|
@ -670,9 +670,26 @@ public class UserGroupInformation {
|
||||||
public synchronized
|
public synchronized
|
||||||
static UserGroupInformation getLoginUser() throws IOException {
|
static UserGroupInformation getLoginUser() throws IOException {
|
||||||
if (loginUser == null) {
|
if (loginUser == null) {
|
||||||
|
loginUserFromSubject(null);
|
||||||
|
}
|
||||||
|
return loginUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log in a user using the given subject
|
||||||
|
* @parma subject the subject to use when logging in a user, or null to
|
||||||
|
* create a new subject.
|
||||||
|
* @throws IOException if login fails
|
||||||
|
*/
|
||||||
|
@InterfaceAudience.Public
|
||||||
|
@InterfaceStability.Evolving
|
||||||
|
public synchronized
|
||||||
|
static void loginUserFromSubject(Subject subject) throws IOException {
|
||||||
ensureInitialized();
|
ensureInitialized();
|
||||||
try {
|
try {
|
||||||
Subject subject = new Subject();
|
if (subject == null) {
|
||||||
|
subject = new Subject();
|
||||||
|
}
|
||||||
LoginContext login =
|
LoginContext login =
|
||||||
newLoginContext(authenticationMethod.getLoginAppName(),
|
newLoginContext(authenticationMethod.getLoginAppName(),
|
||||||
subject, new HadoopConfiguration());
|
subject, new HadoopConfiguration());
|
||||||
|
@ -707,8 +724,6 @@ public class UserGroupInformation {
|
||||||
LOG.debug("UGI loginUser:"+loginUser);
|
LOG.debug("UGI loginUser:"+loginUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return loginUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
@InterfaceStability.Unstable
|
@InterfaceStability.Unstable
|
||||||
|
|
Loading…
Reference in New Issue