Package java.util

Examples of java.util.PropertyPermission


     * @com.intel.drl.spec_ref
     */
    public static String clearProperty(String key){
        SecurityManager sm = securityManager;
        if (sm != null) {
            sm.checkPermission(new PropertyPermission(key, "write"));
        } else if (key.length() == 0) {
            throw new IllegalArgumentException("key is empty");
        }
        Properties props = getPropertiesUnsecure();
        return (String)props.remove(key);
View Full Code Here


        if (key.length() == 0) {
            throw new IllegalArgumentException("key is empty");
        }
        SecurityManager sm = securityManager;
        if (sm != null) {
            sm.checkPermission(new PropertyPermission(key, "write"));
        }
        Properties props = getPropertiesUnsecure();
        return (String)props.setProperty(key, value);
    }
View Full Code Here

     */
    public void run() throws Exception {
        Class testClass = Class.class;
        Principal testPrin = new FakePrincipal();
        Permission[] testPerm = new Permission[] {
            new PropertyPermission("*", "read") };
        Subject testSubj = new Subject();
        testSubj.getPrincipals().add(testPrin);
        Policy[] testPolicy = new Policy[] {
            new BasePolicyProvider(),
            new DynamicPolicyProviderThrowingUOE(),
View Full Code Here

  }

  private Permissions getPermissions() {
    final Permissions ps = new Permissions();
    ps.add(new AWTPermission("accessEventQueue"));
    ps.add(new PropertyPermission("user.home", "read"));
    ps.add(new PropertyPermission("java.vendor", "read"));
    ps.add(new PropertyPermission("java.version", "read"));
    ps.add(new PropertyPermission("os.name", "read"));
    ps.add(new PropertyPermission("os.arch", "read"));
    ps.add(new PropertyPermission("os.version", "read"));
    ps.add(new SocketPermission("*", "connect,resolve"));
    String uDir = System.getProperty("user.home");
    if (uDir != null) {
      uDir += "/";
    } else {
View Full Code Here

  }

  private Permissions getPermissions() {
    final Permissions ps = new Permissions();
    ps.add(new AWTPermission("accessEventQueue"));
    ps.add(new PropertyPermission("user.home", "read"));
    ps.add(new PropertyPermission("java.vendor", "read"));
    ps.add(new PropertyPermission("java.version", "read"));
    ps.add(new PropertyPermission("os.name", "read"));
    ps.add(new PropertyPermission("os.arch", "read"));
    ps.add(new PropertyPermission("os.version", "read"));
    ps.add(new SocketPermission("*", "connect,resolve"));
    ps.add(new FilePermission(Configuration.Paths.getScriptCacheDirectory(), "read,write,delete"));
    ps.setReadOnly();
    return ps;
  }
View Full Code Here

  @Test
  public void testSecuritySanity() throws Exception {
    AccessControlContext acc = provider.getAccessControlContext();
    try {
      acc.checkPermission(new PropertyPermission("*", "read"));
      fail("Acc should not have any permissions");
    } catch (SecurityException se) {
      // expected
    }

View Full Code Here

    return list;
  }

  protected List getIAndTPermissions() {
    List perms = super.getIAndTPermissions();
    perms.add(new PropertyPermission("*", "read"));
    perms.add(new PropertyPermission("*", "write"));
    return perms;
  }
View Full Code Here

            }
            Permission perm = new RuntimePermission("SSLPassword");
            AccessController.checkPermission(perm);
        } catch (AccessControlException e) {
            String message = e.getMessage();
            Permission perm = new PropertyPermission(key, "read");
            if (message != null) {
                message = message.replace(e.getPermission().toString(), perm.toString());
            }
            throw new AccessControlException(message, perm);
        }
    }
View Full Code Here

        return new TestSuite(SecurityTest.class);
    }

    public void testForbiddenProperty() {
        String script = "System.getProperty(\"user.home\")";
        assertExecute(script, null, new PropertyPermission("user.home", "read"));
    }
View Full Code Here

   */
  public static String setProperty(String key, String value)
  {
    SecurityManager sm = SecurityManager.current; // Be thread-safe.
    if (sm != null)
      sm.checkPermission(new PropertyPermission(key, "write"));
    // This handles both the null pointer exception and the illegal
    // argument exception.
    if (key.length() == 0)
      throw new IllegalArgumentException("key can't be empty");
    return SystemProperties.setProperty(key, value);
View Full Code Here

TOP

Related Classes of java.util.PropertyPermission

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.