Search in sources :

Example 26 with SocketPermission

use of java.net.SocketPermission in project wildfly by wildfly.

the class RebindTestCase method deploy.

@Deployment
public static Archive<?> deploy() {
    String tmpdir = System.getProperty("jboss.home");
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "RebindTestCase.jar");
    jar.addClasses(RebindTestCase.class, BindingLookupBean.class);
    jar.addAsManifestResource(new StringAsset("Dependencies: org.jboss.as.controller, " + "org.jboss.remoting3\n"), "MANIFEST.MF");
    jar.addAsManifestResource(createPermissionsXmlAsset(new RemotingPermission("addConnectionProvider"), new RemotingPermission("connect"), new RemotingPermission("createEndpoint"), new RuntimePermission("createXnioWorker"), new FilePermission(tmpdir + "/standalone/tmp/auth/-", "read"), new SocketPermission(TestSuiteEnvironment.getServerAddress(), "connect,resolve")), "permissions.xml");
    return jar;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) SocketPermission(java.net.SocketPermission) 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 27 with SocketPermission

use of java.net.SocketPermission in project wildfly by wildfly.

the class AuthenticationTestCase method deployment.

/*
     * Authentication Scenarios
     *
     * Client -> Bean
     * Client -> Bean -> Bean
     * Client -> Bean (Re-auth) -> Bean
     * Client -> Servlet -> Bean
     * Client -> Servlet (Re-auth) -> Bean
     * Client -> Servlet -> Bean -> Bean
     * Client -> Servlet -> Bean (Re Auth) -> Bean
     */
@Deployment
public static Archive<?> deployment() {
    final Package currentPackage = AuthenticationTestCase.class.getPackage();
    // using JavaArchive doesn't work, because of a bug in Arquillian, it only deploys wars properly
    final WebArchive war = ShrinkWrap.create(WebArchive.class, "ejb3security.war").addPackage(WhoAmIBean.class.getPackage()).addPackage(EntryBean.class.getPackage()).addClass(WhoAmI.class).addClass(Util.class).addClass(Entry.class).addClasses(WhoAmIServlet.class, AuthenticationTestCase.class).addClasses(AbstractSecurityDomainSetup.class, EjbSecurityDomainSetup.class).addClass(TestSuiteEnvironment.class).addAsResource(currentPackage, "users.properties", "users.properties").addAsResource(currentPackage, "roles.properties", "roles.properties").addAsWebInfResource(currentPackage, "web.xml", "web.xml").addAsWebInfResource(currentPackage, "jboss-web.xml", "jboss-web.xml").addAsWebInfResource(currentPackage, "jboss-ejb3.xml", "jboss-ejb3.xml").addAsManifestResource(new StringAsset("Manifest-Version: 1.0\nDependencies: org.jboss.as.controller-client,org.jboss.dmr\n"), "MANIFEST.MF").addAsManifestResource(createPermissionsXmlAsset(// login module needs to modify pricipal to commit logging in
    new AuthPermission("modifyPrincipals"), // AuthenticationTestCase#testAuthenticatedCall calls org.jboss.security.client.JBossSecurityClient#performSimpleLogin
    new RuntimePermission("org.jboss.security.getSecurityContext"), new RuntimePermission("org.jboss.security.SecurityContextFactory.createSecurityContext"), new RuntimePermission("org.jboss.security.SecurityContextFactory.createUtil"), new RuntimePermission("org.jboss.security.plugins.JBossSecurityContext.setSubjectInfo"), new RuntimePermission("org.jboss.security.setSecurityContext"), // AuthenticationTestCase#execute calls ExecutorService#shutdownNow
    new RuntimePermission("modifyThread"), // AuthenticationTestCase#execute calls sun.net.www.http.HttpClient#openServer under the hood
    new SocketPermission(SERVER_HOST_PORT, "connect,resolve"), // TestSuiteEnvironment reads system properties
    new PropertyPermission("management.address", "read"), new PropertyPermission("node0", "read"), new PropertyPermission("jboss.http.port", "read")), "permissions.xml");
    war.addPackage(CommonCriteria.class.getPackage());
    return war;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) PropertyPermission(java.util.PropertyPermission) AuthPermission(javax.security.auth.AuthPermission) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) SocketPermission(java.net.SocketPermission) Util(org.jboss.as.test.shared.integration.ejb.security.Util) WhoAmIBean(org.jboss.as.test.integration.ejb.security.base.WhoAmIBean) TestSuiteEnvironment(org.jboss.as.test.shared.TestSuiteEnvironment) CommonCriteria(org.jboss.as.test.categories.CommonCriteria) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 28 with SocketPermission

use of java.net.SocketPermission in project wildfly by wildfly.

the class VaultDatasourceTestCase method deployment.

@Deployment
public static WebArchive deployment() {
    final WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war");
    war.addAsManifestResource(createPermissionsXmlAsset(new SocketPermission("*:9092", "connect,resolve")), "permissions.xml");
    return war;
}
Also used : WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) SocketPermission(java.net.SocketPermission) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 29 with SocketPermission

use of java.net.SocketPermission in project wildfly by wildfly.

the class PasswordMaskingInContainerTestCase method deploy.

@Deployment
public static WebArchive deploy() {
    WebArchive war = ShrinkWrap.create(WebArchive.class, "passwordMasking" + ".war");
    war.addClass(PasswordMaskingTestServlet.class);
    war.setWebXML(PasswordMaskingInContainerTestCase.class.getPackage(), "web.xml");
    war.addAsManifestResource(createPermissionsXmlAsset(new SocketPermission("*:9092", "connect,resolve")), "permissions.xml");
    return war;
}
Also used : WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) SocketPermission(java.net.SocketPermission) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 30 with SocketPermission

use of java.net.SocketPermission in project wildfly by wildfly.

the class ServiceRefTestCase method deployment.

@Deployment
public static JavaArchive deployment() {
    String wsdl = FileUtils.readFile(ServiceRefTestCase.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);
    }
    return ShrinkWrap.create(JavaArchive.class, "ws-serviceref-example.jar").addClasses(EJB3Bean.class, EndpointInterface.class, EndpointService.class, StatelessBean.class, StatelessRemote.class, CdiBean.class).addAsManifestResource(ServiceRefTestCase.class.getPackage(), "ejb-jar.xml", "ejb-jar.xml").addAsManifestResource(ServiceRefTestCase.class.getPackage(), "jboss-ejb3.xml", "jboss-ejb3.xml").addAsManifestResource(new StringAsset(PropertiesValueResolver.replaceProperties(wsdl, properties)), "wsdl/TestService.wsdl").addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml").addAsManifestResource(createPermissionsXmlAsset(new FilePermission(System.getProperty("java.home") + File.separator + "lib" + File.separator + "wsdl.properties", "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");
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) PropertyPermission(java.util.PropertyPermission) SocketPermission(java.net.SocketPermission) Properties(java.util.Properties) FilePermission(java.io.FilePermission) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Aggregations

SocketPermission (java.net.SocketPermission)45 Deployment (org.jboss.arquillian.container.test.api.Deployment)13 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)10 AccessControlContext (java.security.AccessControlContext)9 PropertyPermission (java.util.PropertyPermission)9 FilePermission (java.io.FilePermission)8 Test (org.testng.annotations.Test)8 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)7 URL (java.net.URL)6 IOException (java.io.IOException)5 DatagramSocket (java.net.DatagramSocket)5 InetAddress (java.net.InetAddress)4 InetSocketAddress (java.net.InetSocketAddress)4 MulticastSocket (java.net.MulticastSocket)4 ServerSocket (java.net.ServerSocket)3 Permissions (java.security.Permissions)3 PrivilegedActionException (java.security.PrivilegedActionException)3 Properties (java.util.Properties)3 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)3 File (java.io.File)2