Package java.util

Examples of java.util.PropertyPermission


            property = AccessController.doPrivileged(new PrivilegedAction<String>() {

                public String run() {
                    return System.getProperty(propName);
                }
            }, null, new PropertyPermission(propName, "read"));
        } catch (SecurityException se) {
            trace("error getting " + propName + ":  "+ se);
            if (debug) {
                se.printStackTrace();
            }
View Full Code Here


     * @see        java.lang.System#getProperties()
     * @see        java.lang.System#setProperties(java.util.Properties)
     * @see        #checkPermission(java.security.Permission) checkPermission
     */
    public void checkPropertiesAccess() {
        checkPermission(new PropertyPermission("*",
            SecurityConstants.PROPERTY_RW_ACTION));
    }
View Full Code Here

     *
     * @see        java.lang.System#getProperty(java.lang.String)
     * @see        #checkPermission(java.security.Permission) checkPermission
     */
    public void checkPropertyAccess(String key) {
        checkPermission(new PropertyPermission(key,
            SecurityConstants.PROPERTY_READ_ACTION));
    }
View Full Code Here

                    return null;
                }
            }, null,
            new FilePermission("<<ALL FILES>>", "read, write"),
            // createDirectories may need it
            new PropertyPermission("user.dir", "read"));
        }

        return UNSAFE.defineAnonymousClass(targetClass, classBytes, null);
    }
View Full Code Here

  RuntimePermission rp = new RuntimePermission("getClassLoader");
  p.add( rp );
 
  // JspFactory.getPageContext() runs in JSP Context and needs the below
  // permission during the init of a servlet generated from a JSP.
  PropertyPermission pp = new PropertyPermission("line.separator","read");
  p.add(pp);
  pp = new PropertyPermission("file.separator", "read");
  p.add(pp);
  pp = new PropertyPermission("path.separator", "read");
  p.add(pp);

  if( debug > 0 || context.getDebug() > 0 )
      context.log( "permissions " + p );
     
View Full Code Here

  public void test_Constructor$Ljava_security_ProtectionDomain() {
    // Test for method
    // java.security.AccessControlContext(java.security.ProtectionDomain [])

    // Create a permission which is not normally granted
    final Permission perm = new PropertyPermission("java.class.path",
        "read");
    PermissionCollection col = perm.newPermissionCollection();
    col.add(perm);
    final ProtectionDomain pd = new ProtectionDomain(null, col);
    AccessControlContext acc = new AccessControlContext(
        new ProtectionDomain[] { pd });
    try {
View Full Code Here

        if (prop.length() == 0) {
            throw new IllegalArgumentException();
        }
        SecurityManager secMgr = System.getSecurityManager();
        if (secMgr != null) {
            secMgr.checkPermission(new PropertyPermission(prop, "write"));
        }
        return (String) systemProperties.setProperty(prop, value);
    }
View Full Code Here

            throw new IllegalArgumentException();
        }

        SecurityManager secMgr = System.getSecurityManager();
        if (secMgr != null) {
            secMgr.checkPermission(new PropertyPermission(key, "write"));
        }
        return (String) systemProperties.remove(key);
    }
View Full Code Here

        result.add(new TcPermission("http://example.org/area/allowed/*", "readwrite"));
        result.add(new TcPermission("urn:x-localinstance:/graph-access.graph", "readwrite"));
        //result.add(new AllPermission());
        result.add(new RuntimePermission("*"));
        result.add(new ReflectPermission("suppressAccessChecks"));
        result.add(new PropertyPermission("*", "read"));
        //(java.util.PropertyPermission line.separator read)
        result.add(new FilePermission("/-", "read,write"));
        return result;
      }
    });
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

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.