hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bor...@apache.org
Subject svn commit: r952454 - in /hadoop/common/trunk: CHANGES.txt src/java/org/apache/hadoop/security/UserGroupInformation.java src/test/core/org/apache/hadoop/security/TestUserGroupInformation.java
Date Mon, 07 Jun 2010 21:50:06 GMT
Author: boryas
Date: Mon Jun  7 21:50:05 2010
New Revision: 952454

URL: http://svn.apache.org/viewvc?rev=952454&view=rev
Log:
HADOOP-6687.  user object in the subject in UGI should be reused in case of a relogin.

Modified:
    hadoop/common/trunk/CHANGES.txt
    hadoop/common/trunk/src/java/org/apache/hadoop/security/UserGroupInformation.java
    hadoop/common/trunk/src/test/core/org/apache/hadoop/security/TestUserGroupInformation.java

Modified: hadoop/common/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=952454&r1=952453&r2=952454&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Mon Jun  7 21:50:05 2010
@@ -70,6 +70,9 @@ Trunk (unreleased changes)
 
     HADOOP-6649.  login object in UGI should be inside the subject (jnp via boryas)
 
+    HADOOP-6687.   user object in the subject in UGI should be reused in case 
+    of a relogin. (jnp via boryas)
+
 Release 0.21.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/security/UserGroupInformation.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/security/UserGroupInformation.java?rev=952454&r1=952453&r2=952454&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/security/UserGroupInformation.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/security/UserGroupInformation.java Mon
Jun  7 21:50:05 2010
@@ -88,6 +88,10 @@ public class UserGroupInformation {
 
     @Override
     public boolean commit() throws LoginException {
+      // if we already have a user, we are done.
+      if (!subject.getPrincipals(User.class).isEmpty()) {
+        return true;
+      }
       Principal user = null;
       // if we are using kerberos, try it out
       if (useKerberos) {

Modified: hadoop/common/trunk/src/test/core/org/apache/hadoop/security/TestUserGroupInformation.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/core/org/apache/hadoop/security/TestUserGroupInformation.java?rev=952454&r1=952453&r2=952454&view=diff
==============================================================================
--- hadoop/common/trunk/src/test/core/org/apache/hadoop/security/TestUserGroupInformation.java
(original)
+++ hadoop/common/trunk/src/test/core/org/apache/hadoop/security/TestUserGroupInformation.java
Mon Jun  7 21:50:05 2010
@@ -302,4 +302,18 @@ public class TestUserGroupInformation {
     //login1 and login2 must be same instances
     Assert.assertTrue(login1 == login2);
   }
+  
+  @Test
+  public void testLoginModuleCommit() throws Exception {
+    UserGroupInformation loginUgi = UserGroupInformation.getLoginUser();
+    User user1 = loginUgi.getSubject().getPrincipals(User.class).iterator()
+        .next();
+    LoginContext login = user1.getLogin();
+    login.logout();
+    login.login();
+    User user2 = loginUgi.getSubject().getPrincipals(User.class).iterator()
+        .next();
+    // user1 and user2 must be same instances.
+    Assert.assertTrue(user1 == user2);
+  }
 }



Mime
View raw message