Search in sources :

Example 6 with ElytronPermission

use of org.wildfly.security.permission.ElytronPermission in project wildfly by wildfly.

the class MixedSecurityAnnotationAuthorizationTestCase method runAsDeployment.

@Deployment
public static Archive<?> runAsDeployment() {
    final Package currentPackage = AnnotationAuthorizationTestCase.class.getPackage();
    final WebArchive war = ShrinkWrap.create(WebArchive.class, "ejb3security.war").addClasses(RolesAllowedOverrideBean.class, RolesAllowedOverrideBeanBase.class, PermitAllOverrideBean.class, DenyAllOverrideBean.class).addClass(Util.class).addClasses(MixedSecurityAnnotationAuthorizationTestCase.class).addClasses(AbstractSecurityDomainSetup.class, EjbSecurityDomainSetup.class, ElytronDomainSetup.class, EjbElytronDomainSetup.class, ServletElytronDomainSetup.class).addAsWebInfResource(currentPackage, "jboss-web.xml", "jboss-web.xml");
    war.addAsManifestResource(createPermissionsXmlAsset(new ElytronPermission("getSecurityDomain"), new ElytronPermission("authenticate")), "permissions.xml");
    war.addPackage(CommonCriteria.class.getPackage());
    return war;
}
Also used : ServletElytronDomainSetup(org.wildfly.test.security.common.elytron.ServletElytronDomainSetup) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) EjbElytronDomainSetup(org.wildfly.test.security.common.elytron.EjbElytronDomainSetup) ServletElytronDomainSetup(org.wildfly.test.security.common.elytron.ServletElytronDomainSetup) ElytronDomainSetup(org.wildfly.test.security.common.elytron.ElytronDomainSetup) CommonCriteria(org.jboss.as.test.categories.CommonCriteria) Util(org.jboss.as.test.shared.integration.ejb.security.Util) EjbElytronDomainSetup(org.wildfly.test.security.common.elytron.EjbElytronDomainSetup) ElytronPermission(org.wildfly.security.permission.ElytronPermission) AbstractSecurityDomainSetup(org.jboss.as.test.integration.security.common.AbstractSecurityDomainSetup) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 7 with ElytronPermission

use of org.wildfly.security.permission.ElytronPermission in project wildfly by wildfly.

the class MDBRoleTestCase method deployment.

@Deployment
public static Archive<?> deployment() {
    final JavaArchive deployment = ShrinkWrap.create(JavaArchive.class, "ejb3mdb.jar").addClass(MDBRole.class).addClass(CreateQueueSetupTask.class).addClasses(AbstractSecurityDomainSetup.class, EjbSecurityDomainSetup.class).addClass(Simple.class).addClass(SimpleSLSB.class).addClass(TimeoutUtil.class);
    deployment.addAsManifestResource(MDBRoleTestCase.class.getPackage(), "jboss-ejb3.xml", "jboss-ejb3.xml");
    deployment.addPackage(CommonCriteria.class.getPackage());
    // grant necessary permissions
    // TODO WFLY-15289 The Elytron permissions need to be checked, should a deployment really need these?
    deployment.addAsResource(createPermissionsXmlAsset(new PropertyPermission("ts.timeout.factor", "read"), new ElytronPermission("setRunAsPrincipal"), new ElytronPermission("handleSecurityEvent"), new ChangeRoleMapperPermission("ejb")), "META-INF/jboss-permissions.xml");
    return deployment;
}
Also used : MDBRole(org.jboss.as.test.integration.ejb.security.authorization.MDBRole) PropertyPermission(java.util.PropertyPermission) SimpleSLSB(org.jboss.as.test.integration.ejb.security.authorization.SimpleSLSB) CommonCriteria(org.jboss.as.test.categories.CommonCriteria) ElytronPermission(org.wildfly.security.permission.ElytronPermission) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) ChangeRoleMapperPermission(org.wildfly.security.auth.permission.ChangeRoleMapperPermission) AbstractSecurityDomainSetup(org.jboss.as.test.integration.security.common.AbstractSecurityDomainSetup) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 8 with ElytronPermission

use of org.wildfly.security.permission.ElytronPermission in project wildfly by wildfly.

the class RunAsPrincipalTestCase method runAsStartupTransitiveDeployment.

@Deployment(name = STARTUP_SINGLETON_DEPLOYMENT, managed = false, testable = false)
public static Archive<?> runAsStartupTransitiveDeployment() {
    // using JavaArchive doesn't work, because of a bug in Arquillian, it only deploys wars properly
    final WebArchive war = ShrinkWrap.create(WebArchive.class, STARTUP_SINGLETON_DEPLOYMENT + ".war").addClass(WhoAmI.class).addClass(StatelessBBean.class).addClass(SingletonStartupBean.class).addPackage(Assert.class.getPackage()).addClass(Util.class).addClass(Entry.class).addClass(RunAsPrincipalTestCase.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 ElytronPermission("authenticate")), "permissions.xml");
    war.addPackage(CommonCriteria.class.getPackage());
    return war;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) CommonCriteria(org.jboss.as.test.categories.CommonCriteria) StatelessBBean(org.jboss.as.test.integration.ejb.security.runasprincipal.StatelessBBean) ElytronPermission(org.wildfly.security.permission.ElytronPermission) AbstractSecurityDomainSetup(org.jboss.as.test.integration.security.common.AbstractSecurityDomainSetup) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 9 with ElytronPermission

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).addClass(HttpUtil.class).addClasses(WhoAmIServlet.class, AuthenticationTestCase.class).addClasses(ElytronDomainSetup.class, EjbElytronDomainSetup.class, ServletElytronDomainSetup.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"), // TestSuiteEnvironment reads system properties
    new ElytronPermission("getSecurityDomain"), new ElytronPermission("authenticate")), "permissions.xml");
    war.addPackage(CommonCriteria.class.getPackage());
    return war;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) HttpUtil(org.wildfly.test.integration.elytron.util.HttpUtil) ServletElytronDomainSetup(org.wildfly.test.security.common.elytron.ServletElytronDomainSetup) AuthPermission(javax.security.auth.AuthPermission) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) SocketPermission(java.net.SocketPermission) HttpUtil(org.wildfly.test.integration.elytron.util.HttpUtil) Util(org.jboss.as.test.shared.integration.ejb.security.Util) EjbElytronDomainSetup(org.wildfly.test.security.common.elytron.EjbElytronDomainSetup) WhoAmIBean(org.wildfly.test.integration.elytron.ejb.base.WhoAmIBean) EjbElytronDomainSetup(org.wildfly.test.security.common.elytron.EjbElytronDomainSetup) ServletElytronDomainSetup(org.wildfly.test.security.common.elytron.ServletElytronDomainSetup) ElytronDomainSetup(org.wildfly.test.security.common.elytron.ElytronDomainSetup) CommonCriteria(org.jboss.as.test.categories.CommonCriteria) ElytronPermission(org.wildfly.security.permission.ElytronPermission) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 10 with ElytronPermission

use of org.wildfly.security.permission.ElytronPermission in project wildfly by wildfly.

the class AggregateRealmTestCase method deploymentAttributeAggregation.

@Deployment(name = AGGREGATE_ATTRIBUTES_NAME)
public static WebArchive deploymentAttributeAggregation() {
    final WebArchive war = ShrinkWrap.create(WebArchive.class, AGGREGATE_ATTRIBUTES_NAME + ".war");
    war.addClasses(AttributePrintingServlet.class);
    war.addAsWebInfResource(AggregateRealmTestCase.class.getPackage(), "aggregate-realm-web.xml", "web.xml");
    war.addAsWebInfResource(Utils.getJBossWebXmlAsset(AGGREGATE_ATTRIBUTES_NAME), "jboss-web.xml");
    war.addAsManifestResource(createPermissionsXmlAsset(new ElytronPermission("getSecurityDomain")), "permissions.xml");
    return war;
}
Also used : WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) ElytronPermission(org.wildfly.security.permission.ElytronPermission) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Aggregations

Deployment (org.jboss.arquillian.container.test.api.Deployment)27 ElytronPermission (org.wildfly.security.permission.ElytronPermission)27 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)17 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)15 CommonCriteria (org.jboss.as.test.categories.CommonCriteria)13 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)13 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)12 AbstractSecurityDomainSetup (org.jboss.as.test.integration.security.common.AbstractSecurityDomainSetup)6 ChangeRoleMapperPermission (org.wildfly.security.auth.permission.ChangeRoleMapperPermission)6 AuthPermission (javax.security.auth.AuthPermission)5 TargetsContainer (org.jboss.arquillian.container.test.api.TargetsContainer)4 Properties (java.util.Properties)3 PropertyPermission (java.util.PropertyPermission)3 Util (org.jboss.as.test.shared.integration.ejb.security.Util)3 SocketPermission (java.net.SocketPermission)2 EjbElytronDomainSetup (org.wildfly.test.security.common.elytron.EjbElytronDomainSetup)2 ElytronDomainSetup (org.wildfly.test.security.common.elytron.ElytronDomainSetup)2 ServletElytronDomainSetup (org.wildfly.test.security.common.elytron.ServletElytronDomainSetup)2 FilePermission (java.io.FilePermission)1 SecurityPermission (java.security.SecurityPermission)1