Author: ddas Date: Sat Jan 30 19:57:39 2010 New Revision: 904861 URL: http://svn.apache.org/viewvc?rev=904861&view=rev Log: HADOOP-6520. Adds APIs to read/write Token and secret keys. Also adds the automatic loading of tokens into UserGroupInformation upon login. The tokens are read from a file specified in the environment variable. Contributed by Devaraj Das.
Modified: hadoop/common/trunk/CHANGES.txt hadoop/common/trunk/src/java/org/apache/hadoop/security/UserGroupInformation.java Modified: hadoop/common/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=904861&r1=904860&r2=904861&view=diff ============================================================================== --- hadoop/common/trunk/CHANGES.txt (original) +++ hadoop/common/trunk/CHANGES.txt Sat Jan 30 19:57:39 2010 @@ -43,6 +43,11 @@ HADOOP-6464. Write a Rackspace cloud provider. (tomwhite) + HADOOP-6520. Adds APIs to read/write Token and secret keys. Also + adds the automatic loading of tokens into UserGroupInformation + upon login. The tokens are read from a file specified in the + environment variable. (ddas) + IMPROVEMENTS HADOOP-6283. Improve the exception messages thrown by 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=904861&r1=904860&r2=904861&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 Sat Jan 30 19:57:39 2010 @@ -34,7 +34,6 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; -import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -132,6 +131,10 @@ /** Server-side groups fetching service */ private static Groups groups; + /**Environment variable pointing to the token cache file*/ + public static final String HADOOP_TOKEN_FILE_LOCATION = + "HADOOP_TOKEN_FILE_LOCATION"; + /** * A method to initialize the fields that depend on a configuration. * Must be called before useKerberos or groups is used. @@ -317,6 +320,10 @@ } login.login(); loginUser = new UserGroupInformation(login.getSubject()); + String tokenFile = System.getenv(HADOOP_TOKEN_FILE_LOCATION); + if (tokenFile != null && isSecurityEnabled()) { + TokenStorage.readTokensAndLoadInUGI(tokenFile, new Configuration(), loginUser); + } } catch (LoginException le) { throw new IOException("failure to login", le); }