Search in sources :

Example 56 with FilePermission

use of java.io.FilePermission in project wildfly by wildfly.

the class RemoteCallClientInterceptorTestCase method deployment1.

@Deployment(name = AbstractClientInterceptorsSetupTask.DEPLOYMENT_NAME_CLIENT)
@TargetsContainer(AbstractClientInterceptorsSetupTask.TARGER_CONTAINER_CLIENT)
public static Archive<?> deployment1() {
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class, ARCHIVE_NAME_CLIENT + ".jar");
    jar.addClasses(Util.class, ClientInterceptorUtil.class);
    jar.addClasses(StatelessBean.class, StatelessRemote.class);
    jar.addClasses(RemoteCallClientInterceptorTestCase.class, ClientInterceptor.class);
    jar.addPackage(AbstractClientInterceptorsSetupTask.class.getPackage());
    jar.addAsManifestResource("META-INF/jboss-ejb-client-receivers.xml", "jboss-ejb-client.xml");
    jar.addAsManifestResource(createPermissionsXmlAsset(new SecurityPermission("putProviderProperty.WildFlyElytron"), new FilePermission(System.getProperty("jboss.home") + File.separatorChar + "standalone" + File.separatorChar + "tmp" + File.separatorChar + "auth" + File.separatorChar + "-", "read")), "permissions.xml");
    return jar;
}
Also used : AbstractClientInterceptorsSetupTask(org.jboss.as.test.shared.integration.interceptor.clientside.AbstractClientInterceptorsSetupTask) FilePermission(java.io.FilePermission) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) SecurityPermission(java.security.SecurityPermission) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Deployment(org.jboss.arquillian.container.test.api.Deployment) TargetsContainer(org.jboss.arquillian.container.test.api.TargetsContainer)

Example 57 with FilePermission

use of java.io.FilePermission in project wildfly by wildfly.

the class DatabaseTimerServiceMultiNodeTestCase method createDeployment.

private static Archive<?> createDeployment(boolean client) {
    final WebArchive war = ShrinkWrap.create(WebArchive.class, ARCHIVE_NAME + ".war");
    war.addClasses(Collector.class, RemoteTimedBean.class, TimedObjectTimerServiceBean.class, TimerData.class, FileUtils.class, StartupSingleton.class);
    war.addAsWebInfResource(DatabaseTimerServiceMultiNodeTestCase.class.getPackage(), "jboss-ejb3.xml", "jboss-ejb3.xml");
    if (!client) {
        war.addClass(CollectionSingleton.class);
    }
    war.addAsResource(new StringAsset(client ? "client" : "server"), "node.txt");
    if (client) {
        war.addAsManifestResource(DatabaseTimerServiceMultiNodeExecutionDisabledTestCase.class.getPackage(), "jboss-ejb-client.xml", "jboss-ejb-client.xml");
        war.addAsManifestResource(createPermissionsXmlAsset(new SocketPermission("*:9092", "connect,resolve"), new SecurityPermission("putProviderProperty.WildFlyElytron"), new FilePermission(System.getProperty("jboss.home") + File.separatorChar + "standalone" + File.separatorChar + "tmp" + File.separatorChar + "auth" + File.separatorChar + "-", "read")), "permissions.xml");
    }
    return war;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) SocketPermission(java.net.SocketPermission) FilePermission(java.io.FilePermission) SecurityPermission(java.security.SecurityPermission)

Example 58 with FilePermission

use of java.io.FilePermission in project wildfly by wildfly.

the class ServiceRefSevletTestCase method clientDeployment.

@Deployment(name = "servletClient", testable = false)
public static WebArchive clientDeployment() {
    WebArchive war = ShrinkWrap.create(WebArchive.class, "ws-serviceref-example-servlet-client.war").addClasses(EndpointInterface.class, EndpointService.class, ServletClient.class).addAsWebInfResource(ServiceRefSevletTestCase.class.getPackage(), "web.xml", "web.xml").addAsWebInfResource(ServiceRefSevletTestCase.class.getPackage(), "jboss-web.xml", "jboss-web.xml");
    String wsdl = FileUtils.readFile(ServiceRefSevletTestCase.class, "TestService.wsdl");
    final Properties properties = new Properties();
    properties.putAll(System.getProperties());
    final String node0 = NetworkUtils.formatPossibleIpv6Address((String) properties.get("node0"));
    if (properties.containsKey("node0")) {
        properties.put("node0", node0);
    }
    war.addAsWebInfResource(new StringAsset(PropertiesValueResolver.replaceProperties(wsdl, properties)), "wsdl/TestService.wsdl");
    // all the following permissions are needed because EndpointService directly extends javax.xml.ws.Service class
    // and CXF guys are not willing to add more privileged blocks into their code, thus deployments need to have
    // the following permissions (note that the wsdl.properties permission is needed by wsdl4j)
    war.addAsManifestResource(createPermissionsXmlAsset(new FilePermission("<<ALL FILES>>", "read"), new PropertyPermission("user.dir", "read"), new RuntimePermission("getClassLoader"), new RuntimePermission("org.apache.cxf.permission", "resolveUri"), new RuntimePermission("createClassLoader"), new RuntimePermission("accessDeclaredMembers"), new SocketPermission(node0 + ":8080", "connect,resolve")), "jboss-permissions.xml");
    return war;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) PropertyPermission(java.util.PropertyPermission) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) SocketPermission(java.net.SocketPermission) Properties(java.util.Properties) FilePermission(java.io.FilePermission) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 59 with FilePermission

use of java.io.FilePermission in project wildfly by wildfly.

the class ServerInterceptorsTestCase method deploy.

@Deployment
public static Archive<?> deploy() {
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "test-server-interceptor.jar");
    jar.addPackage(ServerInterceptorsTestCase.class.getPackage());
    jar.addPackage(AbstractServerInterceptorsSetupTask.class.getPackage());
    jar.addAsManifestResource(new StringAsset("Dependencies: org.jboss.as.controller-client," + "org.jboss.dmr," + "org.jboss.remoting\n"), "MANIFEST.MF");
    jar.addAsManifestResource(createPermissionsXmlAsset(new RemotingPermission("connect"), new RemotingPermission("createEndpoint"), new FilePermission(System.getProperty("jboss.inst") + "/standalone/tmp/auth/*", "read")), "permissions.xml");
    return jar;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) AbstractServerInterceptorsSetupTask(org.jboss.as.test.shared.integration.ejb.interceptor.serverside.AbstractServerInterceptorsSetupTask) RemotingPermission(org.jboss.remoting3.security.RemotingPermission) FilePermission(java.io.FilePermission) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 60 with FilePermission

use of java.io.FilePermission in project wildfly by wildfly.

the class SimpleRestClientTestCase method deploy.

@Deployment
public static Archive<?> deploy() {
    WebArchive war = ShrinkWrap.create(WebArchive.class);
    war.addClass(SimpleRestClientTestCase.class);
    war.addClass(OpenTracingApplication.class);
    war.addClass(TracedEndpoint.class);
    war.addClass(MockTracerFactory.class);
    war.addPackage(MockTracer.class.getPackage());
    war.addAsServiceProvider(TracerFactory.class, MockTracerFactory.class);
    war.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
    war.addAsManifestResource(createPermissionsXmlAsset(// Required for the ClientBuilder.newBuilder() so the ServiceLoader will work
    new FilePermission("<<ALL FILES>>", "read"), // reflection test to check for JAXRS 2.0.
    new RuntimePermission("accessDeclaredMembers"), // Required for the client to connect
    new SocketPermission(TestSuiteEnvironment.getHttpAddress() + ":" + TestSuiteEnvironment.getHttpPort(), "connect,resolve")), "permissions.xml");
    return war;
}
Also used : WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) SocketPermission(java.net.SocketPermission) MockTracer(io.opentracing.mock.MockTracer) FilePermission(java.io.FilePermission) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Aggregations

FilePermission (java.io.FilePermission)143 Deployment (org.jboss.arquillian.container.test.api.Deployment)38 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)29 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)29 PropertyPermission (java.util.PropertyPermission)23 IOException (java.io.IOException)22 RemotingPermission (org.jboss.remoting3.security.RemotingPermission)21 Permission (java.security.Permission)20 File (java.io.File)19 URL (java.net.URL)19 PermissionCollection (java.security.PermissionCollection)19 SocketPermission (java.net.SocketPermission)18 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)16 ReflectPermission (java.lang.reflect.ReflectPermission)12 Test (org.junit.Test)12 Permissions (java.security.Permissions)11 CodeSource (java.security.CodeSource)9 Path (java.nio.file.Path)8 SecurityPermission (java.security.SecurityPermission)8 Policy (java.security.Policy)7