HADOOP-6814. Adds an API in UserGroupInformation to get the real authentication method of a passed UGI. Contributed by Jitendra Pandey.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@953863 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
754ea912b9
commit
755a5d8c9b
|
@ -50,6 +50,9 @@ Trunk (unreleased changes)
|
|||
HADOOP-6526. Need mapping from long principal names to local OS
|
||||
user names. (boryas)
|
||||
|
||||
HADOOP-6814. Adds an API in UserGroupInformation to get the real
|
||||
authentication method of a passed UGI. (Jitendra Pandey via ddas)
|
||||
|
||||
BUG FIXES
|
||||
HADOOP-6638. try to relogin in a case of failed RPC connection (expired tgt)
|
||||
only in case the subject is loginUser or proxyUgi.realUser. (boryas)
|
||||
|
|
|
@ -735,6 +735,22 @@ public class UserGroupInformation {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the authentication method of a ugi. If the authentication method is
|
||||
* PROXY, returns the authentication method of the real user.
|
||||
*
|
||||
* @param ugi
|
||||
* @return AuthenticationMethod
|
||||
*/
|
||||
public static AuthenticationMethod getRealAuthenticationMethod(
|
||||
UserGroupInformation ugi) {
|
||||
AuthenticationMethod authMethod = ugi.getAuthenticationMethod();
|
||||
if (authMethod == AuthenticationMethod.PROXY) {
|
||||
authMethod = ugi.getRealUser().getAuthenticationMethod();
|
||||
}
|
||||
return authMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the subjects to see if they are equal to each other.
|
||||
|
|
|
@ -277,6 +277,8 @@ public class TestUserGroupInformation {
|
|||
Assert.assertEquals(am, ugi.getAuthenticationMethod());
|
||||
Assert.assertEquals(null, proxyUgi.getAuthenticationMethod());
|
||||
proxyUgi.setAuthenticationMethod(AuthenticationMethod.PROXY);
|
||||
Assert.assertEquals(am, UserGroupInformation
|
||||
.getRealAuthenticationMethod(proxyUgi));
|
||||
proxyUgi.doAs(new PrivilegedExceptionAction<Object>() {
|
||||
public Object run() throws IOException {
|
||||
Assert.assertEquals(AuthenticationMethod.PROXY, UserGroupInformation
|
||||
|
|
Loading…
Reference in New Issue