Search in sources :

Example 41 with OperateOnDeployment

use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.

the class SPNEGOLoginModuleTestCase method testInvalidKerberosSpnegoWorkflow.

/**
     * SPNEGO simple scenario - more mechanismTypes is provided and the Kerberos mechanism is the most preferable one. Client
     * provides invalid token in the first round.
     */
@Test
@OperateOnDeployment("WEB")
@Ignore("JBEAP-4114")
public void testInvalidKerberosSpnegoWorkflow(@ArquillianResource URL webAppURL) throws Exception {
    final URI uri = getServletURI(webAppURL, SimpleSecuredServlet.SERVLET_PATH);
    final String[] mechTypes = new String[] { OID_KERBEROS_V5, OID_DUMMY };
    assertSpnegoWorkflow(uri, mechTypes, DUMMY_TOKEN, null, false, false);
}
Also used : URI(java.net.URI) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 42 with OperateOnDeployment

use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.

the class SPNEGOLoginModuleTestCase method testSimpleSpnegoWorkflow.

/**
     * SPNEGO simple scenario - only kerberos mechanism is provided with valid token.
     */
@Test
@OperateOnDeployment("WEB")
public void testSimpleSpnegoWorkflow(@ArquillianResource URL webAppURL) throws Exception {
    KerberosTestUtils.assumeKerberosAuthenticationSupported();
    final URI uri = getServletURI(webAppURL, SimpleSecuredServlet.SERVLET_PATH);
    final String[] mechTypes = new String[] { OID_KERBEROS_V5 };
    assertSpnegoWorkflow(uri, mechTypes, createNewKerberosTicketForHttp(uri), null, false, true);
}
Also used : URI(java.net.URI) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Example 43 with OperateOnDeployment

use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.

the class SPNEGOLoginModuleTestCase method testIdentityPropagation.

/**
     * Tests identity propagation by requesting {@link PropagateIdentityServlet}.
     *
     * @throws Exception
     */
@Test
@OperateOnDeployment("WEB")
public void testIdentityPropagation(@ArquillianResource URL webAppURL) throws Exception {
    KerberosTestUtils.assumeKerberosAuthenticationSupported();
    final URI servletUri = getServletURI(webAppURL, PropagateIdentityServlet.SERVLET_PATH);
    LOGGER.trace("Testing identity propagation " + servletUri);
    final String responseBody = Utils.makeCallWithKerberosAuthn(servletUri, "jduke", "theduke", HttpServletResponse.SC_OK);
    assertEquals("Unexpected response body.", "jduke@JBOSS.ORG", responseBody);
}
Also used : URI(java.net.URI) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Example 44 with OperateOnDeployment

use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.

the class SAML2KerberosAuthenticationTestCase method testJDukeRoles.

/**
     * Test roles for jduke user.
     *
     * @throws Exception
     */
@Test
@OperateOnDeployment(SERVICE_PROVIDER_NAME)
public void testJDukeRoles(@ArquillianResource URL webAppURL, @ArquillianResource @OperateOnDeployment(IDENTITY_PROVIDER_NAME) URL idpURL) throws Exception {
    final URI rolesPrintingURL = new URI(webAppURL.toExternalForm() + RolePrintingServlet.SERVLET_PATH.substring(1) + "?test=testDeploymentViaKerberos&" + KerberosServerSetupTask.QUERY_ROLES);
    String responseBody = makeCallWithKerberosAuthn(rolesPrintingURL, idpURL.toURI(), "jduke", DUKE_PASSWORD);
    final List<String> assignedRolesList = Arrays.asList("TheDuke", "Echo", "Admin");
    for (String role : KerberosServerSetupTask.ROLE_NAMES) {
        if (assignedRolesList.contains(role)) {
            assertThat("Missing role assignment", responseBody, containsString("," + role + ","));
        } else {
            assertThat("Unexpected role assignment", responseBody, not(containsString("," + role + ",")));
        }
    }
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) URI(java.net.URI) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Example 45 with OperateOnDeployment

use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.

the class SAML2KerberosAuthenticationTestCase method testJDukePrincipal.

/**
     * Test principal for jduke user.
     *
     * @throws Exception
     */
@Test
@OperateOnDeployment(SERVICE_PROVIDER_NAME)
public void testJDukePrincipal(@ArquillianResource URL webAppURL, @ArquillianResource @OperateOnDeployment(IDENTITY_PROVIDER_NAME) URL idpURL) throws Exception {
    final String cannonicalHost = Utils.getCannonicalHost(mgmtClient);
    final URI principalPrintingURL = new URI(webAppURL.toExternalForm() + PrincipalPrintingServlet.SERVLET_PATH.substring(1) + "?test=testDeploymentViaKerberos");
    String responseBody = makeCallWithKerberosAuthn(principalPrintingURL, Utils.replaceHost(idpURL.toURI(), cannonicalHost), "jduke", DUKE_PASSWORD);
    assertThat("Unexpected principal", responseBody, equalTo("jduke"));
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) URI(java.net.URI) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) Test(org.junit.Test)

Aggregations

OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)94 Test (org.junit.Test)93 URL (java.net.URL)31 URI (java.net.URI)22 HttpGet (org.apache.http.client.methods.HttpGet)20 HttpResponse (org.apache.http.HttpResponse)17 InitialContext (javax.naming.InitialContext)15 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)13 QName (javax.xml.namespace.QName)11 Service (javax.xml.ws.Service)11 HttpEntity (org.apache.http.HttpEntity)10 Bus (org.apache.cxf.Bus)9 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)9 WrapThreadContextClassLoader (org.jboss.as.test.integration.ws.WrapThreadContextClassLoader)9 ActAsServiceIface (org.jboss.as.test.integration.ws.wsse.trust.actas.ActAsServiceIface)6 OnBehalfOfServiceIface (org.jboss.as.test.integration.ws.wsse.trust.onbehalfof.OnBehalfOfServiceIface)6 GetMethodWebRequest (com.meterware.httpunit.GetMethodWebRequest)5 WebConversation (com.meterware.httpunit.WebConversation)5 WebForm (com.meterware.httpunit.WebForm)5 WebRequest (com.meterware.httpunit.WebRequest)5