use of org.jboss.as.test.integration.security.common.ejb3.HelloBean in project wildfly by wildfly.
the class RemotingLoginModuleUseNewClientCertTestCase method testAuthorizedClient.
/**
* Tests that an authorized user has access to an EJB method.
*
* @throws Exception
*/
@Test
public void testAuthorizedClient() throws Exception {
final Properties env = configureEjbClient(CLIENT_AUTHORIZED_NAME);
InitialContext ctx = new InitialContext(env);
final Hello helloBean = (Hello) ctx.lookup(HELLOBEAN_LOOKUP_NAME);
assertEquals(HelloBean.HELLO_WORLD, helloBean.sayHelloWorld());
ctx.close();
}
use of org.jboss.as.test.integration.security.common.ejb3.HelloBean in project wildfly by wildfly.
the class RemotingLoginModuleTestCase method testNotAuthorizedClient.
/**
* Tests if role check is done correctly for authenticated user.
*
* @throws Exception
*/
@Test
public void testNotAuthorizedClient() throws Exception {
final Properties env = configureEjbClient(CLIENT_NOT_AUTHORIZED_NAME);
InitialContext ctx = new InitialContext(env);
final Hello helloBean = (Hello) ctx.lookup(HELLOBEAN_LOOKUP_NAME);
try {
helloBean.sayHelloWorld();
fail("The EJB call should fail for unauthorized client.");
} catch (EJBAccessException e) {
//OK
}
ctx.close();
}
use of org.jboss.as.test.integration.security.common.ejb3.HelloBean in project wildfly by wildfly.
the class RemotingLoginModuleTestCase method testAuthorizedClient.
/**
* Tests that an authorized user has access to an EJB method.
*
* @throws Exception
*/
@Test
public void testAuthorizedClient() throws Exception {
final Properties env = configureEjbClient(CLIENT_AUTHORIZED_NAME);
InitialContext ctx = new InitialContext(env);
final Hello helloBean = (Hello) ctx.lookup(HELLOBEAN_LOOKUP_NAME);
assertEquals(HelloBean.HELLO_WORLD, helloBean.sayHelloWorld());
ctx.close();
}
use of org.jboss.as.test.integration.security.common.ejb3.HelloBean in project wildfly by wildfly.
the class RemotingLoginModuleUseNewClientCertTestCase method testNotAuthorizedClient.
/**
* Tests if role check is done correctly for authenticated user.
*
* @throws Exception
*/
@Test
public void testNotAuthorizedClient() throws Exception {
final Properties env = configureEjbClient(CLIENT_NOT_AUTHORIZED_NAME);
InitialContext ctx = new InitialContext(env);
final Hello helloBean = (Hello) ctx.lookup(HELLOBEAN_LOOKUP_NAME);
try {
helloBean.sayHelloWorld();
fail("The EJB call should fail for unauthorized client.");
} catch (EJBAccessException e) {
//OK
}
ctx.close();
}
Aggregations