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);
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class SPNEGOLoginModuleTestCase method testUnsecured.
/**
* Unsecured request.
*
* @throws Exception
*/
@Test
@OperateOnDeployment("WEB")
public void testUnsecured(@ArquillianResource URL webAppURL) throws Exception {
final URI servletUri = getServletURI(webAppURL, SimpleServlet.SERVLET_PATH);
LOGGER.trace("Testing access to unprotected resource " + servletUri);
final String responseBody = Utils.makeCallWithKerberosAuthn(servletUri, null, null, HttpServletResponse.SC_OK);
assertEquals("Unexpected response body.", SimpleServlet.RESPONSE_BODY, responseBody);
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class SPNEGOLoginModuleTestCase method testNoKerberosSpnegoWorkflow.
/**
* SPNEGO simple scenario - more mechanismTypes is provided but the Kerberos mechanism is not listed as the supported one.
*/
@Test
@OperateOnDeployment("WEB")
public void testNoKerberosSpnegoWorkflow(@ArquillianResource URL webAppURL) throws Exception {
final URI uri = getServletURI(webAppURL, SimpleSecuredServlet.SERVLET_PATH);
final String[] mechTypes = new String[] { OID_DUMMY, OID_NTLM };
assertSpnegoWorkflow(uri, mechTypes, DUMMY_TOKEN, null, false, false);
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class SPNEGOLoginModuleTestCase method testMoreMechTypesSpnegoWorkflow.
/**
* SPNEGO simple scenario - more mechanismTypes is provided but the Kerberos mechanism is most preferable one and it has a
* valid token.
*/
@Test
@OperateOnDeployment("WEB")
public void testMoreMechTypesSpnegoWorkflow(@ArquillianResource URL webAppURL) throws Exception {
KerberosTestUtils.assumeKerberosAuthenticationSupported();
final URI uri = getServletURI(webAppURL, SimpleSecuredServlet.SERVLET_PATH);
final String[] mechTypes = new String[] { OID_KERBEROS_V5, OID_DUMMY, OID_KERBEROS_V5_LEGACY };
assertSpnegoWorkflow(uri, mechTypes, createNewKerberosTicketForHttp(uri), null, false, true);
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class SPNEGOLoginModuleTestCase method testUnsuccessfulAuthn.
/**
* Incorrect login.
*
* @throws Exception
*/
@Test
@OperateOnDeployment("WEB")
public void testUnsuccessfulAuthn(@ArquillianResource URL webAppURL) throws Exception {
final URI servletUri = getServletURI(webAppURL, SimpleSecuredServlet.SERVLET_PATH);
LOGGER.trace("Testing failed authentication " + servletUri);
try {
Utils.makeCallWithKerberosAuthn(servletUri, "jduke", "the%", HttpServletResponse.SC_OK);
fail();
} catch (LoginException e) {
// OK
}
try {
Utils.makeCallWithKerberosAuthn(servletUri, "jd%", "theduke", HttpServletResponse.SC_OK);
fail();
} catch (LoginException e) {
// OK
}
}
Aggregations