use of org.webpieces.plugin.secure.sslcert.acme.ProxyOrder in project webpieces by deanhiller.
the class TestFullSslSetupWizard method postOrgAndPlaceOrderAndFinalizeOrder.
private MockProxyAuthorization postOrgAndPlaceOrderAndFinalizeOrder(String url) throws MalformedURLException {
URL accountUrl = new URL("http://someurlfor.com/myexact/account/1234");
mockAcmeClient.setOpenAccount(XFuture.completedFuture(accountUrl));
List<ProxyAuthorization> proxyAuth = new ArrayList<>();
MockProxyAuthorization mockProxyAuth = new MockProxyAuthorization("domain.com", Instant.now(), Status.PENDING, new URL("http://somelocation.asdf"), "sometokenforwebdisplay", "authcontent111");
proxyAuth.add(mockProxyAuth);
mockAcmeClient.setProxyOrder(XFuture.completedFuture(new ProxyOrder(null, proxyAuth)));
mockAcmeClient.setCertAndSigningRequest(XFuture.completedFuture(new CertAndSigningRequest("fakecsr", new ArrayList<>())));
HttpFullRequest req = Requests.createPostRequest(url, "organization", "DeanCo");
req.addHeader(new Header(KnownHeaderName.COOKIE, "webSession=1-xjrs6SeNeSxmJQtaTwM8gDorNiQ=:backendUser=admin"));
XFuture<HttpFullResponse> respFuture = https11Socket.send(req);
ResponseWrapper response = ResponseExtract.waitResponseAndWrap(respFuture);
response.assertStatusCode(KnownStatusCode.HTTP_303_SEEOTHER);
List<Header> headers = response.getResponse().getHeaderLookupStruct().getHeaders(KnownHeaderName.LOCATION);
Assert.assertEquals(1, headers.size());
Assert.assertEquals("https://myhost.com/@sslcert/maintainssl", headers.get(0).getValue());
return mockProxyAuth;
}
Aggregations