HADOOP-7982. UserGroupInformation fails to login if thread's context classloader can't load HadoopLoginModule. Contributed by Todd Lipcon.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1233751 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6861560098
commit
b7eb5334f5
|
@ -279,6 +279,9 @@ Release 0.23.1 - Unreleased
|
|||
HADOOP-7971. Adding back job/pipes/queue commands to bin/hadoop for
|
||||
backward compatibility. (Prashath Sharma via acmurthy)
|
||||
|
||||
HADOOP-7982. UserGroupInformation fails to login if thread's context
|
||||
classloader can't load HadoopLoginModule. (todd)
|
||||
|
||||
Release 0.23.0 - 2011-11-01
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -416,9 +416,19 @@ public class UserGroupInformation {
|
|||
|
||||
private static LoginContext
|
||||
newLoginContext(String appName, Subject subject) throws LoginException {
|
||||
return new LoginContext(appName, subject, null, new HadoopConfiguration());
|
||||
// Temporarily switch the thread's ContextClassLoader to match this
|
||||
// class's classloader, so that we can properly load HadoopLoginModule
|
||||
// from the JAAS libraries.
|
||||
Thread t = Thread.currentThread();
|
||||
ClassLoader oldCCL = t.getContextClassLoader();
|
||||
t.setContextClassLoader(HadoopLoginModule.class.getClassLoader());
|
||||
try {
|
||||
return new LoginContext(appName, subject, null, new HadoopConfiguration());
|
||||
} finally {
|
||||
t.setContextClassLoader(oldCCL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private LoginContext getLogin() {
|
||||
return user.getLogin();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue