use of org.wildfly.security.permission.ElytronPermission in project wildfly by wildfly.
the class IIOPSecurityInvocationTestCase method clientDeployment.
@Deployment(name = "client", testable = true)
@TargetsContainer("iiop-client")
public static Archive<?> clientDeployment() {
/*
* The @EJB annotation doesn't allow to specify the address dynamically. So, istead of
* @EJB(lookup = "corbaname:iiop:localhost:3628#IIOPTransactionalStatelessBean")
* private IIOPTransactionalHome home;
* we need to do this trick to get the ${node0} sys prop into ejb-jar.xml
* and have it injected that way.
*/
String ejbJar = FileUtils.readFile(IIOPSecurityInvocationTestCase.class, "ejb-jar.xml");
final Properties properties = new Properties();
properties.putAll(System.getProperties());
if (properties.containsKey("node1")) {
properties.put("node1", NetworkUtils.formatPossibleIpv6Address((String) properties.get("node1")));
}
final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "client.jar");
jar.addClasses(ClientEjb.class, IIOPSecurityStatelessHome.class, IIOPSecurityStatelessRemote.class, IIOPSecurityInvocationTestCase.class, Util.class).addAsManifestResource(IIOPSecurityInvocationTestCase.class.getPackage(), "jboss-ejb3.xml", "jboss-ejb3.xml").addAsManifestResource(new StringAsset(PropertiesValueResolver.replaceProperties(ejbJar, properties)), "ejb-jar.xml").addAsManifestResource(PermissionUtils.createPermissionsXmlAsset(new ElytronPermission("authenticate"), new ElytronPermission("getSecurityDomain"), new ElytronPermission("getPrivateCredentials")), "permissions.xml");
return jar;
}
use of org.wildfly.security.permission.ElytronPermission in project wildfly by wildfly.
the class RemoteIdentityTestCase method createDeployment.
/**
* Creates a deployment application for this test.
*
* @return
* @throws IOException
*/
@Deployment
public static JavaArchive createDeployment() throws IOException {
final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, EJBUtil.APPLICATION_NAME + ".jar");
jar.addClasses(SecurityInformation.class, IntermediateAccess.class, EntryBean.class, SecuredBean.class, Util.class);
jar.addAsManifestResource(createPermissionsXmlAsset(// testSwitched(), i.e. org.jboss.as.test.shared.integration.ejb.security.Util#getCLMLoginContext(username, password), needs the following
new AuthPermission("modifyPrincipals"), // testSwitched(), i.e. org.jboss.as.test.shared.integration.ejb.security.Util#switchIdentity(String, String, Callable<T>, boolean), i.e. SecurityDomain.getCurrent(), needs the following
new ElytronPermission("getSecurityDomain"), // and testSwitched() -> Util.switchIdentity() -> securityDomain.authenticate(...) needs the following
new ElytronPermission("authenticate")), "permissions.xml");
return jar;
}
use of org.wildfly.security.permission.ElytronPermission in project wildfly by wildfly.
the class RunAsPrincipalTestCase method runAsDeployment.
@Deployment
public static Archive<?> runAsDeployment() {
// using JavaArchive doesn't work, because of a bug in Arquillian, it only deploys wars properly
final WebArchive war = ShrinkWrap.create(WebArchive.class, DEPLOYMENT + ".war").addPackage(WhoAmI.class.getPackage()).addClass(SimpleSingletonBean.class).addClass(StatelessSingletonUseBean.class).addClass(Util.class).addClass(Entry.class).addClass(RunAsPrincipalTestCase.class).addClass(TestLogHandlerSetupTask.class).addClass(LoggingUtil.class).addClasses(AbstractSecurityDomainSetup.class, EjbSecurityDomainSetup.class).addAsWebInfResource(RunAsPrincipalTestCase.class.getPackage(), "jboss-ejb3.xml", "jboss-ejb3.xml").addAsManifestResource(new StringAsset("Dependencies: org.jboss.as.controller-client,org.jboss.dmr\n"), "MANIFEST.MF").addAsManifestResource(createPermissionsXmlAsset(new ElytronPermission("getSecurityDomain"), new PropertyPermission("jboss.server.log.dir", "read"), PermissionUtils.createFilePermission("read", "standalone", "log", TEST_LOG_FILE_NAME), new ElytronPermission("authenticate"), new ElytronPermission("getIdentity"), new ElytronPermission("createAdHocIdentity"), new ChangeRoleMapperPermission("ejb"), new ElytronPermission("setRunAsPrincipal")), "permissions.xml");
war.addPackage(CommonCriteria.class.getPackage());
return war;
}
use of org.wildfly.security.permission.ElytronPermission in project wildfly by wildfly.
the class AuthenticationTestCase method deployment.
@Deployment
public static Archive<?> deployment() {
final String SERVER_HOST_PORT = TestSuiteEnvironment.getHttpAddress() + ":" + TestSuiteEnvironment.getHttpPort();
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).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 principal to commit logging in
new AuthPermission("modifyPrincipals"), // 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"), new ElytronPermission("getSecurityDomain"), new ElytronPermission("authenticate")), "permissions.xml");
war.addPackage(CommonCriteria.class.getPackage());
return war;
}
use of org.wildfly.security.permission.ElytronPermission in project wildfly by wildfly.
the class RunAsEjbMdbTestCase method runAsEJB3.
@Deployment(testable = false, managed = true, name = "ejb3", order = 2)
public static Archive<?> runAsEJB3() {
final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "runasmdbejb-ejb3.jar").addClasses(HelloBean.class, Hello.class, HolaBean.class, Hola.class, Howdy.class, HowdyBean.class, HelloMDB.class, TimeoutUtil.class);
// TODO WFLY-15289 Should these permissions be required?
jar.addAsResource(createPermissionsXmlAsset(new PropertyPermission("ts.timeout.factor", "read"), new ElytronPermission("setRunAsPrincipal"), new ElytronPermission("handleSecurityEvent"), new ChangeRoleMapperPermission("ejb")), "META-INF/jboss-permissions.xml");
jar.addAsManifestResource(new StringAsset("Dependencies: deployment.runasmdbejb-ejb2.jar \n"), "MANIFEST.MF");
return jar;
}
Aggregations