Author: acmurthy Date: Fri Dec 7 07:41:34 2012 New Revision: 1418203 URL: http://svn.apache.org/viewvc?rev=1418203&view=rev Log: Merge -c 1418202 from branch-1 to branch-1.1 to fix MAPREDUCE-4858. Fixed TestWebUIAuthorization. Contributed by Arun C. Murthy.
Modified: hadoop/common/branches/branch-1.1/CHANGES.txt hadoop/common/branches/branch-1.1/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java hadoop/common/branches/branch-1.1/src/test/org/apache/hadoop/mapred/TestWebUIAuthorization.java Modified: hadoop/common/branches/branch-1.1/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1.1/CHANGES.txt?rev=1418203&r1=1418202&r2=1418203&view=diff ============================================================================== --- hadoop/common/branches/branch-1.1/CHANGES.txt (original) +++ hadoop/common/branches/branch-1.1/CHANGES.txt Fri Dec 7 07:41:34 2012 @@ -50,6 +50,8 @@ Release 1.1.2 - 2012.12.07 MAPREDUCE-4699. Fixed unit test failures - TestFairScheduler and TestCapacityScheduler. (Gopal V via sseth) + MAPREDUCE-4858. Fixed TestWebUIAuthorization. (acmurthy) + Release 1.1.1 - 2012.11.18 INCOMPATIBLE CHANGES Modified: hadoop/common/branches/branch-1.1/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1.1/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java?rev=1418203&r1=1418202&r2=1418203&view=diff ============================================================================== --- hadoop/common/branches/branch-1.1/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java (original) +++ hadoop/common/branches/branch-1.1/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NameNode.java Fri Dec 7 07:41:34 2012 @@ -90,6 +90,8 @@ import org.apache.hadoop.security.author import org.apache.hadoop.security.token.SecretManager.InvalidToken; import org.apache.hadoop.security.token.Token; import org.apache.hadoop.util.StringUtils; +import org.apache.hadoop.security.authorize.PolicyProvider; +import org.apache.hadoop.util.ReflectionUtils; /********************************************************** * NameNode serves as both directory namespace manager and @@ -270,7 +272,12 @@ public class NameNode implements ClientP if (serviceAuthEnabled = conf.getBoolean( ServiceAuthorizationManager.SERVICE_AUTHORIZATION_CONFIG, false)) { - ServiceAuthorizationManager.refresh(conf, new HDFSPolicyProvider()); + PolicyProvider policyProvider = + (PolicyProvider)(ReflectionUtils.newInstance( + conf.getClass(PolicyProvider.POLICY_PROVIDER_CONFIG, + HDFSPolicyProvider.class, PolicyProvider.class), + conf)); + ServiceAuthorizationManager.refresh(conf, policyProvider); } myMetrics = NameNodeInstrumentation.create(conf); Modified: hadoop/common/branches/branch-1.1/src/test/org/apache/hadoop/mapred/TestWebUIAuthorization.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1.1/src/test/org/apache/hadoop/mapred/TestWebUIAuthorization.java?rev=1418203&r1=1418202&r2=1418203&view=diff ============================================================================== --- hadoop/common/branches/branch-1.1/src/test/org/apache/hadoop/mapred/TestWebUIAuthorization.java (original) +++ hadoop/common/branches/branch-1.1/src/test/org/apache/hadoop/mapred/TestWebUIAuthorization.java Fri Dec 7 07:41:34 2012 @@ -40,6 +40,8 @@ import org.apache.hadoop.examples.SleepJ import org.apache.hadoop.security.Groups; import org.apache.hadoop.security.ShellBasedUnixGroupsMapping; import org.apache.hadoop.security.UserGroupInformation; +import org.apache.hadoop.security.authorize.HadoopPolicyProvider; +import org.apache.hadoop.security.authorize.PolicyProvider; import org.junit.Test; import java.security.PrivilegedExceptionAction; @@ -776,7 +778,13 @@ public class TestWebUIAuthorization exte Properties props = new Properties(); props.setProperty("hadoop.http.filter.initializers", DummyFilterInitializer.class.getName()); - props.setProperty(CommonConfigurationKeys.HADOOP_SECURITY_AUTHORIZATION, "true"); + props.setProperty(CommonConfigurationKeys.HADOOP_SECURITY_AUTHORIZATION, + "true"); + props.setProperty(PolicyProvider.POLICY_PROVIDER_CONFIG, + HadoopPolicyProvider.class.getName()); + props.setProperty( + CommonConfigurationKeys.HADOOP_SECURITY_INSTRUMENTATION_REQUIRES_ADMIN, + "true"); props.setProperty(JobConf.MR_ADMINS, mrAdminUser + " " + mrAdminGroup); startCluster(true, props);