Search in sources :

Example 61 with PropertyPermission

use of java.util.PropertyPermission in project wildfly by wildfly.

the class RemoteFailoverTestCase method createDeployment.

private static Archive<?> createDeployment() {
    final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, MODULE_NAME + ".jar");
    jar.addPackage(Incrementor.class.getPackage());
    jar.addPackage(EJBDirectory.class.getPackage());
    jar.setManifest(new StringAsset("Manifest-Version: 1.0\nDependencies: org.infinispan\n"));
    jar.addAsManifestResource(createPermissionsXmlAsset(new PropertyPermission(NODE_NAME_PROPERTY, "read")), "permissions.xml");
    return jar;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) PropertyPermission(java.util.PropertyPermission) Incrementor(org.jboss.as.test.clustering.cluster.ejb.remote.bean.Incrementor) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) RemoteEJBDirectory(org.jboss.as.test.clustering.ejb.RemoteEJBDirectory) EJBDirectory(org.jboss.as.test.clustering.ejb.EJBDirectory)

Example 62 with PropertyPermission

use of java.util.PropertyPermission in project wildfly by wildfly.

the class RegistryTestCase method createDeployment.

private static Archive<?> createDeployment() {
    final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, MODULE_NAME + ".jar");
    jar.addPackage(RegistryRetriever.class.getPackage());
    jar.addAsManifestResource(createPermissionsXmlAsset(new PropertyPermission(NODE_NAME_PROPERTY, "read")), "permissions.xml");
    return jar;
}
Also used : PropertyPermission(java.util.PropertyPermission) RegistryRetriever(org.jboss.as.test.clustering.cluster.registry.bean.RegistryRetriever) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive)

Example 63 with PropertyPermission

use of java.util.PropertyPermission in project jdk8u_jdk by JetBrains.

the class MyBasicPermission method tryPropPC.

static void tryPropPC() throws Exception {
    try {
        PropertyPermission p0 = new PropertyPermission("user.home", "read");
        PermissionCollection pc = p0.newPermissionCollection();
        // this should lock out future adds
        pc.setReadOnly();
        //
        PropertyPermission p1 = new PropertyPermission("java.home", "read");
        pc.add(p1);
        throw new Exception("Failed...PropertyPermission added to readonly PropertyPermissionCollection.");
    } catch (SecurityException se) {
        System.out.println("PropertyPermissionCollection passed");
    }
}
Also used : PropertyPermission(java.util.PropertyPermission)

Example 64 with PropertyPermission

use of java.util.PropertyPermission in project jdk8u_jdk by JetBrains.

the class TestPolicy method setMinimalPermissions.

/*
     * Defines the minimal permissions required by testNG when running these
     * tests
     */
private void setMinimalPermissions() {
    permissions.add(new SecurityPermission("getPolicy"));
    permissions.add(new SecurityPermission("setPolicy"));
    permissions.add(new RuntimePermission("getClassLoader"));
    permissions.add(new RuntimePermission("setSecurityManager"));
    permissions.add(new RuntimePermission("createSecurityManager"));
    permissions.add(new PropertyPermission("testng.show.stack.frames", "read"));
    permissions.add(new PropertyPermission("line.separator", "read"));
    permissions.add(new PropertyPermission("fileStringBuffer", "read"));
    permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
    permissions.add(new PropertyPermission("java.io.tmpdir", "read"));
    permissions.add(new FilePermission("<<ALL FILES>>", "read, write, delete"));
}
Also used : PropertyPermission(java.util.PropertyPermission) FilePermission(java.io.FilePermission) SecurityPermission(java.security.SecurityPermission)

Example 65 with PropertyPermission

use of java.util.PropertyPermission in project jdk8u_jdk by JetBrains.

the class WildcardPrincipalName method main.

public static void main(String[] args) throws Exception {
    X500Principal duke = new X500Principal("CN=Duke");
    PropertyPermission pp = new PropertyPermission("user.home", "read");
    RunAsPrivilegedUserAction runAsPrivilegedUserAction = new RunAsPrivilegedUserAction(duke, new CheckPermissionAction(pp));
    AccessController.doPrivileged(runAsPrivilegedUserAction);
    System.out.println("test PASSED");
}
Also used : PropertyPermission(java.util.PropertyPermission) X500Principal(javax.security.auth.x500.X500Principal)

Aggregations

PropertyPermission (java.util.PropertyPermission)99 Deployment (org.jboss.arquillian.container.test.api.Deployment)49 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)46 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)35 FilePermission (java.io.FilePermission)23 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)18 SocketPermission (java.net.SocketPermission)13 JMSOperations (org.jboss.as.test.integration.common.jms.JMSOperations)13 Permission (java.security.Permission)10 AccessControlException (java.security.AccessControlException)8 RemotingPermission (org.jboss.remoting3.security.RemotingPermission)8 PermissionCollection (java.security.PermissionCollection)7 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)7 ReflectPermission (java.lang.reflect.ReflectPermission)6 EnterpriseArchive (org.jboss.shrinkwrap.api.spec.EnterpriseArchive)6 Permissions (java.security.Permissions)5 SecurityPermission (java.security.SecurityPermission)5 AccessControlContext (java.security.AccessControlContext)4 TimeoutUtil (org.jboss.as.test.shared.TimeoutUtil)4 Method (java.lang.reflect.Method)3