Пример #1
0
  @Test
  public void loginWithHotpSuccess() throws Exception {
    loginPage.open();
    loginPage.login("test-user@localhost", "password");

    Assert.assertTrue(loginTotpPage.isCurrent());

    loginTotpPage.login(otp.generateHOTP("hotpSecret", counter++));

    Assert.assertEquals(RequestType.AUTH_RESPONSE, appPage.getRequestType());

    events.expectLogin().assertEvent();
  }
Пример #2
0
  @Test
  public void loginWithHotpFailure() throws Exception {
    loginPage.open();
    loginPage.login("test-user@localhost", "password");

    Assert.assertTrue(loginTotpPage.isCurrent());

    loginTotpPage.login("123456");
    loginTotpPage.assertCurrent();
    Assert.assertEquals("Invalid authenticator code.", loginPage.getError());

    // loginPage.assertCurrent();  // Invalid authenticator code.
    // Assert.assertEquals("Invalid username or password.", loginPage.getError());

    events
        .expectLogin()
        .error("invalid_user_credentials")
        .session((String) null)
        .removeDetail(Details.CONSENT)
        .assertEvent();
  }