X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2FTestSeparateSessionScope.java;fp=tests%2Forg%2Fcacert%2Fgigi%2FTestSeparateSessionScope.java;h=e676e51bde2501c77e9b74b0c68e093190d768cc;hb=943d8e7ed0ea5a9d56e7e694a3cbd849c52bad16;hp=a28def7c5abbc8b6a1d66137b89e89f310e1da53;hpb=05e8bb67c3407cbecbb528db16b1608d8534907e;p=gigi.git diff --git a/tests/org/cacert/gigi/TestSeparateSessionScope.java b/tests/org/cacert/gigi/TestSeparateSessionScope.java index a28def7c..e676e51b 100644 --- a/tests/org/cacert/gigi/TestSeparateSessionScope.java +++ b/tests/org/cacert/gigi/TestSeparateSessionScope.java @@ -17,31 +17,31 @@ import org.junit.Test; public class TestSeparateSessionScope extends ManagedTest { - @Test - public void testSeparateScope() throws IOException, GeneralSecurityException, SQLException, InterruptedException { - String mail = "thisgo" + createUniqueName() + "@example.com"; - int user = createAssuranceUser("test", "tugo", mail, TEST_PASSWORD); - String cookie = login(mail, TEST_PASSWORD); - String[] csr = generateCSR("/CN=felix@dogcraft.de"); - Certificate c = new Certificate(user, "/CN=testmail@example.com", "sha256", csr[1], CSRType.CSR); - final PrivateKey pk = PemKey.parsePEMPrivateKey(csr[0]); - c.issue().waitFor(60000); - final X509Certificate ce = c.cert(); - String scookie = login(pk, ce); - - assertTrue(isLoggedin(cookie)); - assertFalse(isLoggedin(scookie)); - - URL u = new URL("https://" + getServerName().replaceAll("^www", "secure") + SECURE_REFERENCE); - HttpURLConnection huc = (HttpURLConnection) u.openConnection(); - authenticateClientCert(pk, ce, huc); - huc.setRequestProperty("Cookie", scookie); - assertEquals(200, huc.getResponseCode()); - - HttpURLConnection huc2 = (HttpURLConnection) u.openConnection(); - authenticateClientCert(pk, ce, huc2); - huc2.setRequestProperty("Cookie", cookie); - assertEquals(302, huc2.getResponseCode()); - - } + @Test + public void testSeparateScope() throws IOException, GeneralSecurityException, SQLException, InterruptedException { + String mail = "thisgo" + createUniqueName() + "@example.com"; + int user = createAssuranceUser("test", "tugo", mail, TEST_PASSWORD); + String cookie = login(mail, TEST_PASSWORD); + String[] csr = generateCSR("/CN=felix@dogcraft.de"); + Certificate c = new Certificate(user, "/CN=testmail@example.com", "sha256", csr[1], CSRType.CSR); + final PrivateKey pk = PemKey.parsePEMPrivateKey(csr[0]); + c.issue().waitFor(60000); + final X509Certificate ce = c.cert(); + String scookie = login(pk, ce); + + assertTrue(isLoggedin(cookie)); + assertFalse(isLoggedin(scookie)); + + URL u = new URL("https://" + getServerName().replaceAll("^www", "secure") + SECURE_REFERENCE); + HttpURLConnection huc = (HttpURLConnection) u.openConnection(); + authenticateClientCert(pk, ce, huc); + huc.setRequestProperty("Cookie", scookie); + assertEquals(200, huc.getResponseCode()); + + HttpURLConnection huc2 = (HttpURLConnection) u.openConnection(); + authenticateClientCert(pk, ce, huc2); + huc2.setRequestProperty("Cookie", cookie); + assertEquals(302, huc2.getResponseCode()); + + } }