use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class RestoreOriginalRequestTestCase method testPostOriginalRequest.
@Test
@OperateOnDeployment("service-provider-2")
public void testPostOriginalRequest(@ArquillianResource URL serviceProvider2) throws Exception {
WebRequest request = new GetMethodWebRequest(formatUrl(serviceProvider2) + "/savedRequest/savedRequest.html");
WebConversation conversation = new WebConversation();
WebResponse response = conversation.getResponse(request);
WebForm webForm = response.getForms()[0];
webForm.setParameter("j_username", "tomcat");
webForm.setParameter("j_password", "tomcat");
webForm.getSubmitButtons()[0].click();
response = conversation.getCurrentPage();
assertTrue(response.getText().contains("Back to the original requested resource."));
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class SAMLIDPInitiatedTestCase method testAuthentication.
@Ignore("wait for PL > 2.6.0.CR2")
@Test
@OperateOnDeployment("identity-provider")
public void testAuthentication(@ArquillianResource URL url) throws Exception {
WebConversation conversation = new WebConversation();
HttpUnitOptions.setLoggingHttpHeaders(true);
WebRequest request = new GetMethodWebRequest(url.toString());
WebResponse response = conversation.getResponse(request);
assertEquals(1, response.getForms().length);
WebForm webForm = response.getForms()[0];
webForm.setParameter("j_username", "tomcat");
webForm.setParameter("j_password", "tomcat");
webForm.getSubmitButtons()[0].click();
response = conversation.getCurrentPage();
LOGGER.debug("Response from IDP: " + response.getText());
LOGGER.debug("SP1-URL: " + serviceProviderPostURL);
LOGGER.debug("webURI: " + webURI);
WebLink link = response.getLinkWithID("service-provider-1-id");
assertNotNull("Cannot reach link with id: service-provider-1-id", link);
response = link.click();
assertTrue("Not properly redirected to sp-post1.war", response.getText().contains("Welcome to sp-post1.war"));
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class SAMLIDPInitiatedTestCase method testPostOriginalRequest.
@Test
@OperateOnDeployment("identity-provider")
public void testPostOriginalRequest(@ArquillianResource URL url) throws Exception {
WebRequest request = new GetMethodWebRequest(url.toString());
WebConversation conversation = new WebConversation();
WebResponse response = conversation.getResponse(request);
WebForm webForm = response.getForms()[0];
webForm.setParameter("j_username", "tomcat");
webForm.setParameter("j_password", "tomcat");
webForm.getSubmitButtons()[0].click();
request = new GetMethodWebRequest(url + "?SAML_VERSION=2.0&TARGET=" + this.serviceProviderPostURL + "/savedRequest/savedRequest.jsp");
response = conversation.getResponse(request);
assertTrue(response.getText().contains("Back to the original requested resource."));
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class WebSecurityDIGESTTestCase method testUserWithoutNeededRole.
/**
* Check whether user with correct credentials but without needed role has not access to secured page.
*
* @param url
* @throws Exception
*/
@OperateOnDeployment(DEPLOYMENT)
@Test
public void testUserWithoutNeededRole(@ArquillianResource URL url) throws Exception {
final URL servletUrl = new URL(url.toExternalForm() + SimpleSecuredServlet.SERVLET_PATH.substring(1));
Utils.makeCallWithBasicAuthn(servletUrl, USER_WITHOUT_NEEDED_ROLE, USER_WITHOUT_NEEDED_ROLE_PASSWORD, HTTP_FORBIDDEN);
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class WebSecurityDIGESTTestCase method testCorrectUser.
/**
* Check whether user with correct credentials has access to secured page.
*
* @param url
* @throws Exception
*/
@OperateOnDeployment(DEPLOYMENT)
@Test
public void testCorrectUser(@ArquillianResource URL url) throws Exception {
final URL servletUrl = new URL(url.toExternalForm() + SimpleSecuredServlet.SERVLET_PATH.substring(1));
String responseBody = Utils.makeCallWithBasicAuthn(servletUrl, GOOD_USER, GOOD_USER_PASSWORD, HTTP_OK);
assertEquals("Response body is not correct.", SimpleSecuredServlet.RESPONSE_BODY, responseBody);
}
Aggregations