diff --git a/CHANGES.txt b/CHANGES.txt index 7b34350a98e..796011a9028 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -62,6 +62,9 @@ Trunk (unreleased changes) HADOOP-6835. Add support for concatenated gzip input. (Greg Roelofs via cdouglas) + HADOOP-6845. Renames the TokenStorage class to Credentials. + (Jitendra Pandey via ddas) + OPTIMIZATIONS BUG FIXES diff --git a/src/java/org/apache/hadoop/security/TokenStorage.java b/src/java/org/apache/hadoop/security/Credentials.java similarity index 97% rename from src/java/org/apache/hadoop/security/TokenStorage.java rename to src/java/org/apache/hadoop/security/Credentials.java index 10730aecf13..4f98ae2d3a0 100644 --- a/src/java/org/apache/hadoop/security/TokenStorage.java +++ b/src/java/org/apache/hadoop/security/Credentials.java @@ -33,17 +33,17 @@ import org.apache.hadoop.io.Writable; import org.apache.hadoop.io.WritableUtils; import org.apache.hadoop.security.token.Token; import org.apache.hadoop.security.token.TokenIdentifier; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; -import org.apache.hadoop.conf.Configuration; /** * A class that provides the facilities of reading and writing * secret keys and Tokens. */ -@InterfaceAudience.LimitedPrivate({"MapReduce"}) +@InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"}) @InterfaceStability.Evolving -public class TokenStorage implements Writable { +public class Credentials implements Writable { private Map secretKeysMap = new HashMap(); private Map> tokenMap = @@ -119,7 +119,7 @@ public class TokenStorage implements Writable { Path localTokensFile = new Path (filename); FileSystem localFS = FileSystem.getLocal(conf); FSDataInputStream in = localFS.open(localTokensFile); - TokenStorage ts = new TokenStorage(); + Credentials ts = new Credentials(); ts.readFields(in); for (Token token : ts.getAllTokens()) { ugi.addToken(token); @@ -175,4 +175,4 @@ public class TokenStorage implements Writable { secretKeysMap.put(alias, key); } } -} \ No newline at end of file +} diff --git a/src/java/org/apache/hadoop/security/UserGroupInformation.java b/src/java/org/apache/hadoop/security/UserGroupInformation.java index 50b6641eedc..58b1507473f 100644 --- a/src/java/org/apache/hadoop/security/UserGroupInformation.java +++ b/src/java/org/apache/hadoop/security/UserGroupInformation.java @@ -400,7 +400,7 @@ public class UserGroupInformation { loginUser = new UserGroupInformation(login.getSubject()); String tokenFile = System.getenv(HADOOP_TOKEN_FILE_LOCATION); if (tokenFile != null && isSecurityEnabled()) { - TokenStorage.readTokensAndLoadInUGI(tokenFile, new Configuration(), loginUser); + Credentials.readTokensAndLoadInUGI(tokenFile, new Configuration(), loginUser); } } catch (LoginException le) { throw new IOException("failure to login", le); diff --git a/src/java/org/apache/hadoop/security/authorize/ServiceAuthorizationManager.java b/src/java/org/apache/hadoop/security/authorize/ServiceAuthorizationManager.java index 12da2a73b2b..e6bd5afc645 100644 --- a/src/java/org/apache/hadoop/security/authorize/ServiceAuthorizationManager.java +++ b/src/java/org/apache/hadoop/security/authorize/ServiceAuthorizationManager.java @@ -46,7 +46,7 @@ public class ServiceAuthorizationManager { * * @deprecated Use * {@link CommonConfigurationKeys#HADOOP_SECURITY_AUTHORIZATION} - * Instead. + * instead. */ @Deprecated public static final String SERVICE_AUTHORIZATION_CONFIG = diff --git a/src/test/core/org/apache/hadoop/security/TestTokenStorage.java b/src/test/core/org/apache/hadoop/security/TestCredentials.java similarity index 94% rename from src/test/core/org/apache/hadoop/security/TestTokenStorage.java rename to src/test/core/org/apache/hadoop/security/TestCredentials.java index 27124875d6e..7bedd2d028a 100644 --- a/src/test/core/org/apache/hadoop/security/TestTokenStorage.java +++ b/src/test/core/org/apache/hadoop/security/TestCredentials.java @@ -40,14 +40,15 @@ import javax.crypto.KeyGenerator; import org.apache.hadoop.io.Text; import org.apache.hadoop.io.WritableComparator; -import org.apache.hadoop.security.TokenStorage; +import org.apache.hadoop.security.Credentials; import org.apache.hadoop.security.token.Token; import org.apache.hadoop.security.token.TokenIdentifier; +import org.junit.After; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; -public class TestTokenStorage { +public class TestCredentials { private static final String DEFAULT_HMAC_ALGORITHM = "HmacSHA1"; private static final File tmpDir = new File(System.getProperty("test.build.data", "/tmp"), "mapred"); @@ -57,12 +58,17 @@ public class TestTokenStorage { tmpDir.mkdir(); } + @After + public void tearDown() { + tmpDir.delete(); + } + @SuppressWarnings("unchecked") @Test public void testReadWriteStorage() throws IOException, NoSuchAlgorithmException{ // create tokenStorage Object - TokenStorage ts = new TokenStorage(); + Credentials ts = new Credentials(); Token token1 = new Token(); Token token2 = new Token(); @@ -98,7 +104,7 @@ public class TestTokenStorage { // open and read it back DataInputStream dis = new DataInputStream(new FileInputStream(tmpFileName)); - ts = new TokenStorage(); + ts = new Credentials(); ts.readFields(dis); dis.close(); @@ -129,5 +135,6 @@ public class TestTokenStorage { WritableComparator.compareBytes(kTS, 0, kTS.length, kLocal, 0, kLocal.length)==0); } + tmpFileName.delete(); } }