hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r769439 - in /hadoop/core/branches/HADOOP-3628/src: core/org/apache/hadoop/security/authorize/ConfiguredPolicy.java test/org/apache/hadoop/security/authorize/TestConfiguredPolicy.java
Date Tue, 28 Apr 2009 15:47:33 GMT
Author: stevel
Date: Tue Apr 28 15:47:32 2009
New Revision: 769439

URL: http://svn.apache.org/viewvc?rev=769439&view=rev
Log:
HADOOP-5740 writable permissions on a codebase

Modified:
    hadoop/core/branches/HADOOP-3628/src/core/org/apache/hadoop/security/authorize/ConfiguredPolicy.java
    hadoop/core/branches/HADOOP-3628/src/test/org/apache/hadoop/security/authorize/TestConfiguredPolicy.java

Modified: hadoop/core/branches/HADOOP-3628/src/core/org/apache/hadoop/security/authorize/ConfiguredPolicy.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/HADOOP-3628/src/core/org/apache/hadoop/security/authorize/ConfiguredPolicy.java?rev=769439&r1=769438&r2=769439&view=diff
==============================================================================
--- hadoop/core/branches/HADOOP-3628/src/core/org/apache/hadoop/security/authorize/ConfiguredPolicy.java
(original)
+++ hadoop/core/branches/HADOOP-3628/src/core/org/apache/hadoop/security/authorize/ConfiguredPolicy.java
Tue Apr 28 15:47:32 2009
@@ -22,6 +22,8 @@
 import java.security.Policy;
 import java.security.Principal;
 import java.security.ProtectionDomain;
+import java.security.CodeSource;
+import java.security.Permissions;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -77,7 +79,20 @@
     return super.implies(domain, permission);
   }
 
+  /**
+   * {@inheritDoc}
+   * @return a writable permission collection
+   */
   @Override
+  public PermissionCollection getPermissions(CodeSource codesource) {
+    return new Permissions();
+  }
+
+/**
+ * {@inheritDoc}
+ * @return a writable permission collection
+ */
+@Override
   public PermissionCollection getPermissions(ProtectionDomain domain) {
     PermissionCollection permissionCollection = super.getPermissions(domain);
     for (Principal principal : domain.getPrincipals()) {
@@ -153,4 +168,14 @@
       LOG.debug("Policy - Adding  " + permission + " to " + principal);
     }
   }
+
+  /**
+   * For debugging: identify ourselves and the policyproviders 
+   *
+   * @return a string representation of the object.
+   */
+  @Override
+  public String toString() {
+    return "Hadoop ConfiguredPolicy " + super.toString() + " Policy provider "+ policyProvider;
+  }
 }

Modified: hadoop/core/branches/HADOOP-3628/src/test/org/apache/hadoop/security/authorize/TestConfiguredPolicy.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/HADOOP-3628/src/test/org/apache/hadoop/security/authorize/TestConfiguredPolicy.java?rev=769439&r1=769438&r2=769439&view=diff
==============================================================================
--- hadoop/core/branches/HADOOP-3628/src/test/org/apache/hadoop/security/authorize/TestConfiguredPolicy.java
(original)
+++ hadoop/core/branches/HADOOP-3628/src/test/org/apache/hadoop/security/authorize/TestConfiguredPolicy.java
Tue Apr 28 15:47:32 2009
@@ -18,6 +18,8 @@
 package org.apache.hadoop.security.authorize;
 
 import java.security.Permission;
+import java.security.CodeSource;
+import java.util.PropertyPermission;
 
 import javax.security.auth.Subject;
 
@@ -79,4 +81,11 @@
     }
     assertTrue(failed);
   }
+
+    public void testPolicySupportsAddCodebase() throws Throwable {
+        Configuration conf = new Configuration();
+        ConfiguredPolicy policy = new ConfiguredPolicy(conf, new TestPolicyProvider());
+        policy.getPermissions((CodeSource) null).add(new PropertyPermission("org.apache.hadoop",
"read"));
+    }
+
 }



Mime
View raw message