use of org.wildfly.naming.java.permission.JndiPermission in project wildfly by wildfly.
the class ServiceMBeanSupportTestCase method geTestMBeanSar.
@Deployment(name = ServiceMBeanSupportTestCase.UNMANAGED_SAR_DEPLOYMENT_NAME, managed = false)
public static JavaArchive geTestMBeanSar() {
final JavaArchive sar = ShrinkWrap.create(JavaArchive.class, "service-mbean-support-test.sar");
sar.addClasses(TestServiceMBean.class, TestService.class);
sar.addAsManifestResource(ServiceMBeanSupportTestCase.class.getPackage(), "jboss-service.xml", "jboss-service.xml");
sar.addAsManifestResource(createPermissionsXmlAsset(new JndiPermission("global/env/foo/legacy", "bind,unbind"), new MBeanPermission(TestResultService.class.getPackage().getName() + ".*", "*")), "permissions.xml");
return sar;
}
use of org.wildfly.naming.java.permission.JndiPermission in project wildfly by wildfly.
the class SharedBindingTestCase method deployTwo.
@Deployment(name = BEAN_TWO_JAR_NAME, managed = false)
public static Archive<?> deployTwo() {
final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, BEAN_TWO_JAR_NAME + ".jar");
jar.addClasses(BeanTwo.class, TestResults.class);
jar.addAsManifestResource(SharedBindingTestCase.class.getPackage(), "ejb-jar-two.xml", "ejb-jar.xml");
jar.addAsManifestResource(createPermissionsXmlAsset(new JndiPermission("global/sharedbinds/two", "rebind")), "permissions.xml");
return jar;
}
use of org.wildfly.naming.java.permission.JndiPermission in project wildfly by wildfly.
the class JNDIBindingMBeanTestCase method createDeployment.
@Deployment
public static JavaArchive createDeployment() {
final JavaArchive sar = ShrinkWrap.create(JavaArchive.class, "multiple-jndi-binding-mbeans.sar");
sar.addClasses(JNDIBindingService.class, JNDIBindingMBeanTestCase.class, JNDIBindingServiceMBean.class);
sar.addAsManifestResource(JNDIBindingMBeanTestCase.class.getPackage(), "multiple-jndi-binding-mbeans-jboss-service.xml", "jboss-service.xml");
sar.addAsManifestResource(createPermissionsXmlAsset(new JndiPermission("global/env/foo/-", "bind,unbind")), "permissions.xml");
return sar;
}
use of org.wildfly.naming.java.permission.JndiPermission in project wildfly by wildfly.
the class ServletLifecycleMethodDescriptorTestCase method single.
@Deployment
public static WebArchive single() {
WebArchive war = ShrinkWrap.create(WebArchive.class, "single.war");
war.addClasses(HttpRequest.class, LifeCycleMethodServlet.class);
war.addAsWebInfResource(ServletLifecycleMethodDescriptorTestCase.class.getPackage(), "web.xml", "web.xml");
war.addAsManifestResource(createPermissionsXmlAsset(new JndiPermission("java:global/env/foo", "bind")), "permissions.xml");
return war;
}
use of org.wildfly.naming.java.permission.JndiPermission in project wildfly by wildfly.
the class NamingContext method check.
private void check(Name name, int actions) throws NamingException {
final SecurityManager sm = System.getSecurityManager();
if (sm != null && WildFlySecurityManager.isChecking()) {
// build absolute name (including store's base name)
Name absoluteName = (Name) namingStore.getBaseName().clone();
if (name.isEmpty()) {
absoluteName.addAll(prefix);
} else {
final String firstComponent = name.get(0);
if (firstComponent.startsWith("java:")) {
absoluteName = name;
} else if (firstComponent.isEmpty()) {
absoluteName.addAll(name.getSuffix(1));
} else {
absoluteName.addAll(prefix);
if (name instanceof CompositeName) {
if (name.size() == 1) {
// name could be a nested name
absoluteName.addAll(parseName(firstComponent));
} else {
absoluteName.addAll(name);
}
} else {
absoluteName.addAll(new CompositeName(name.toString()));
}
}
}
sm.checkPermission(new JndiPermission(absoluteName.toString(), actions));
}
}
Aggregations