import java.net.MalformedURLException;
import java.net.URLConnection;
import java.net.URLEncoder;
+import java.security.GeneralSecurityException;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
private String cookie;
@Before
- public void setup() throws IOException {
+ public void setup() throws IOException, GeneralSecurityException, GigiApiException, InterruptedException {
clearCaches();
agentM = createUniqueName() + "@example.org";
applicantM = createUniqueName() + "@example.org";
int applicantId = createVerifiedUser("a", "c", applicantM, TEST_PASSWORD);
applicantName = User.getById(applicantId).getPreferredName().getId();
- cookie = login(agentM, TEST_PASSWORD);
+ User users[] = User.findByEmail(agentM);
+ cookie = cookieWithCertificateLogin(users[0]);
}
private Matcher<String> isVerificationForm() {
String applicantCookie = login(applicantM, TEST_PASSWORD);
String newDob = "day=1&month=1&year=" + ( !succeed ? 1911 : 1910);
-
+ loginCertificate = null;
assertNull(executeBasicWebInteraction(applicantCookie, MyDetails.PATH, newDob + "&action=updateDoB", 0));
uc.getOutputStream().write(("verifiedName=" + applicantName + "&date=" + validVerificationDateString() + "&location=testcase&countryCode=DE&certify=1&rules=1&assertion=1&points=10").getBytes("UTF-8"));
getMailReceiver().receive(applicantM);
String cookie = login(applicantM, TEST_PASSWORD);
+ loginCertificate = null;
URLConnection url = get(cookie, Points.PATH);
String resp = IOUtils.readURL(url);
resp = resp.split(Pattern.quote("</table>"))[1];
getMailReceiver().receive(applicantM);
String cookie = login(agentM, TEST_PASSWORD);
+ loginCertificate = null;
URLConnection url = get(cookie, Points.PATH);
String resp = IOUtils.readURL(url);
resp = resp.split(Pattern.quote("</table>"))[2];
}
@Test
- public void testMultipleVerification() throws IOException {
-
+ public void testMultipleVerification() throws IOException, GeneralSecurityException, GigiApiException, InterruptedException {
User users[] = User.findByEmail(agentM);
int agentID = users[0].getId();
}
@Test
- public void testRANotificationSet() throws IOException, GigiApiException {
+ public void testRANotificationSet() throws IOException, GigiApiException, GeneralSecurityException, InterruptedException {
getMailReceiver().assertEmpty();
User users[] = User.findByEmail(agentM);
User u = users[0];
u.grantGroup(u, Group.VERIFY_NOTIFICATION);
clearCaches();
- cookie = login(agentM, TEST_PASSWORD);
-
- String targetMail = u.getEmail();
+ cookie = cookieWithCertificateLogin(users[0]);
// enter verification
String uniqueLoc = createUniqueName();
executeSuccess("date=" + validVerificationDateString() + "&location=" + uniqueLoc + "&countryCode=DE&certify=1&rules=1&assertion=1&points=10");
getMailReceiver().receive(applicantM);
- TestMail tm = getMailReceiver().receive(targetMail);
+
+ TestMail tm = getMailReceiver().receive(agentM);
assertThat(tm.getMessage(), containsString("You entered a verification for the account with email address " + applicantM));
}
User u = users[0];
u.revokeGroup(u, Group.VERIFY_NOTIFICATION);
clearCaches();
- cookie = login(agentM, TEST_PASSWORD);
// enter verification
String uniqueLoc = createUniqueName();
executeSuccess("date=" + validVerificationDateString() + "&location=" + uniqueLoc + "&countryCode=DE&certify=1&rules=1&assertion=1&points=10");
- TestMail tm;
-
- tm = getMailReceiver().receive(applicantM);
+ TestMail tm = getMailReceiver().receive(applicantM);
assertThat(tm.getMessage(), not(containsString("You entered a verification for the account with email address " + applicantM)));
}
+
+ @Test
+ public void testVerifyWithoutCertLogin() throws IOException {
+ cookie = login(agentM, TEST_PASSWORD);
+ loginCertificate = null;
+ assertEquals(403, get(cookie, VerifyPage.PATH).getResponseCode());
+ }
}