use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class ReuseAuthenticatedSubjectTestCase method testEjbInDifferentSecurityDomain.
/**
* Test whether if web app and EJB belong to the different security domain then the user is authenticated for both web app
* and EJB invoked from that app.
*
* @param url
* @throws Exception
*/
@OperateOnDeployment(DEPLOYMENT_NAME)
@Test
public void testEjbInDifferentSecurityDomain(@ArquillianResource URL url) throws Exception {
resetCounter(url);
final URL servletUrl = new URL(url.toExternalForm() + ReuseAuthenticatedSubjectServlet.SERVLET_PATH.substring(1) + "?" + ReuseAuthenticatedSubjectServlet.SAME_SECURITY_DOMAIN_PARAM + "=false");
String servletOutput = Utils.makeCallWithBasicAuthn(servletUrl, USER, PASSWORD, 200);
Assert.assertEquals("Unexpected servlet output after EJB call", EjbOwnSecurityDomainImpl.SAY_HELLO, servletOutput);
Assert.assertEquals("Authenticated subject was reused for EJB from the different security domain", "2", getCounter(url));
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class JACCForEarModulesTestCase method testWebPermissions.
/**
* Tests web permissions (war directly and war in ear).
*
* @param webAppURL
* @throws Exception
*/
@Test
@OperateOnDeployment("war")
public void testWebPermissions(@ArquillianResource URL webAppURL) throws Exception {
final Document doc = getPermissionDocument(webAppURL);
testJACCWebPermissions(doc.selectSingleNode("/" + ListJACCPoliciesServlet.ROOT_ELEMENT + "/ActiveContextPolicies/ContextPolicy[@contextID='jacc-test.war']"));
testJACCWebPermissions(doc.selectSingleNode("/" + ListJACCPoliciesServlet.ROOT_ELEMENT + "/ActiveContextPolicies/ContextPolicy[@contextID='ear-jacc-test.ear!ear-jacc-test.war']"));
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class UsersRolesLoginModuleTestCase method testExternalFiles.
/**
* testExternalFiles
*
* @throws Exception
* @see #USERS_EXT
* @see #ROLES_EXT
*/
@OperateOnDeployment(DEP1)
@Test
public void testExternalFiles(@ArquillianResource URL url) throws Exception {
final URL servletUrl = new URL(url.toExternalForm() + SimpleSecuredServlet.SERVLET_PATH.substring(1));
//successful authentication and authorization
assertEquals("Response body is not correct.", SimpleSecuredServlet.RESPONSE_BODY, Utils.makeCallWithBasicAuthn(servletUrl, MARCUS, ANIL_PWD, 200));
//successful authentication and unsuccessful authorization
Utils.makeCallWithBasicAuthn(servletUrl, ANIL, MARCUS_PWD, 403);
//tests related to case insensitiveness
Utils.makeCallWithBasicAuthn(servletUrl, ANIL, MARCUS_PWD.toUpperCase(Locale.ENGLISH), 401);
Utils.makeCallWithBasicAuthn(servletUrl, MARCUS, ANIL_PWD.toLowerCase(Locale.ENGLISH), 401);
//unsuccessful authentication
Utils.makeCallWithBasicAuthn(servletUrl, MARCUS, MARCUS_PWD, 401);
Utils.makeCallWithBasicAuthn(servletUrl, ANIL, MARCUS, 401);
Utils.makeCallWithBasicAuthn(servletUrl, ANIL_PWD, MARCUS_PWD, 401);
Utils.makeCallWithBasicAuthn(servletUrl, ANIL, Utils.hashMD5(MARCUS_PWD, Coding.BASE_64), 401);
Utils.makeCallWithBasicAuthn(servletUrl, ANIL, Utils.hashMD5(MARCUS_PWD, Coding.HEX), 401);
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class UsersRolesLoginModuleTestCase method testHashOnlyStorePassword.
/**
* testHashOnlyStorePassword
*
* @throws Exception
*/
@OperateOnDeployment(DEP6a)
@Test
public void testHashOnlyStorePassword(@ArquillianResource URL url) throws Exception {
final URL servletUrl = new URL(url.toExternalForm() + SimpleSecuredServlet.SERVLET_PATH.substring(1));
//successful authentication and authorization
assertEquals("Response body is not correct.", SimpleSecuredServlet.RESPONSE_BODY, Utils.makeCallWithBasicAuthn(servletUrl, ANIL, Utils.hashMD5(ANIL_PWD, Coding.BASE_64), 200));
//successful authentication and unsuccessful authorization
Utils.makeCallWithBasicAuthn(servletUrl, MARCUS, Utils.hashMD5(MARCUS_PWD, Coding.BASE_64), 403);
//unsuccessful authentication
Utils.makeCallWithBasicAuthn(servletUrl, ANIL, ANIL_PWD, 401);
Utils.makeCallWithBasicAuthn(servletUrl, MARCUS, MARCUS_PWD, 401);
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class SPNEGOLoginModuleTestCase method testAuthn.
/**
* Correct login.
*
* @throws Exception
*/
@Test
@OperateOnDeployment("WEB")
public void testAuthn(@ArquillianResource URL webAppURL) throws Exception {
final URI servletUri = getServletURI(webAppURL, SimpleSecuredServlet.SERVLET_PATH);
LOGGER.trace("Testing successful authentication " + servletUri);
final String responseBody = Utils.makeCallWithKerberosAuthn(servletUri, "jduke", "theduke", HttpServletResponse.SC_OK);
assertEquals("Unexpected response body", SimpleSecuredServlet.RESPONSE_BODY, responseBody);
}
Aggregations