Move deleteCookies to before for RecoveryAuthnCodesAuthenticatorTest
Closes #26176 Signed-off-by: rmartinc <rmartinc@redhat.com>
This commit is contained in:
parent
068d383d44
commit
aaf8136c89
3 changed files with 19 additions and 14 deletions
|
@ -139,8 +139,10 @@ public final class WaitUtils {
|
|||
wait.until(not(urlToBe(currentUrl)));
|
||||
}
|
||||
catch (TimeoutException e) {
|
||||
if (driver.getPageSource() != null) {
|
||||
break; // URL has not changed recently - ok, the URL is stable and page is current
|
||||
}
|
||||
}
|
||||
if (maxRedirects == 1) {
|
||||
log.warn("URL seems unstable! (Some redirect are probably still in progress)");
|
||||
}
|
||||
|
|
|
@ -17,10 +17,8 @@
|
|||
|
||||
package org.keycloak.testsuite;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.keycloak.admin.client.resource.RealmResource;
|
||||
import org.keycloak.common.ClientConnection;
|
||||
import org.keycloak.common.util.Resteasy;
|
||||
import org.keycloak.common.util.reflections.Reflections;
|
||||
import org.keycloak.events.Details;
|
||||
import org.keycloak.models.KeycloakSession;
|
||||
|
@ -78,8 +76,13 @@ public abstract class AbstractTestRealmKeycloakTest extends AbstractKeycloakTest
|
|||
}
|
||||
|
||||
|
||||
// Logout user after test
|
||||
@After
|
||||
@Before
|
||||
@Override
|
||||
public void beforeAbstractKeycloakTest() throws Exception {
|
||||
deleteCookies();
|
||||
super.beforeAbstractKeycloakTest();
|
||||
}
|
||||
|
||||
public void deleteCookies() {
|
||||
deleteAllCookiesForRealm("test");
|
||||
}
|
||||
|
|
|
@ -113,9 +113,9 @@ public class BruteForceTest extends AbstractTestRealmKeycloakTest {
|
|||
|
||||
testRealm.setBruteForceProtected(true);
|
||||
testRealm.setFailureFactor(failureFactor);
|
||||
testRealm.setMaxDeltaTimeSeconds(20);
|
||||
testRealm.setMaxDeltaTimeSeconds(60);
|
||||
testRealm.setMaxFailureWaitSeconds(100);
|
||||
testRealm.setWaitIncrementSeconds(5);
|
||||
testRealm.setWaitIncrementSeconds(20);
|
||||
testRealm.setOtpPolicyCodeReusable(true);
|
||||
//testRealm.setQuickLoginCheckMilliSeconds(0L);
|
||||
|
||||
|
@ -132,9 +132,9 @@ public class BruteForceTest extends AbstractTestRealmKeycloakTest {
|
|||
clearAllUserFailures();
|
||||
RealmRepresentation realm = adminClient.realm("test").toRepresentation();
|
||||
realm.setFailureFactor(failureFactor);
|
||||
realm.setMaxDeltaTimeSeconds(20);
|
||||
realm.setMaxDeltaTimeSeconds(60);
|
||||
realm.setMaxFailureWaitSeconds(100);
|
||||
realm.setWaitIncrementSeconds(5);
|
||||
realm.setWaitIncrementSeconds(20);
|
||||
realm.setOtpPolicyCodeReusable(true);
|
||||
adminClient.realm("test").update(realm);
|
||||
} catch (Exception e) {
|
||||
|
@ -492,7 +492,7 @@ public class BruteForceTest extends AbstractTestRealmKeycloakTest {
|
|||
|
||||
// KEYCLOAK-5420
|
||||
// Test to make sure that temporarily disabled doesn't increment failure count
|
||||
testingClient.testing().setTimeOffset(Collections.singletonMap("offset", String.valueOf(6)));
|
||||
testingClient.testing().setTimeOffset(Collections.singletonMap("offset", String.valueOf(21)));
|
||||
// should be unlocked now
|
||||
loginSuccess();
|
||||
clearUserFailures();
|
||||
|
@ -674,11 +674,11 @@ public class BruteForceTest extends AbstractTestRealmKeycloakTest {
|
|||
loginInvalidPassword();
|
||||
loginInvalidPassword();
|
||||
expectTemporarilyDisabled();
|
||||
testingClient.testing().setTimeOffset(Collections.singletonMap("offset", String.valueOf(6)));
|
||||
testingClient.testing().setTimeOffset(Collections.singletonMap("offset", String.valueOf(21)));
|
||||
|
||||
loginInvalidPassword();
|
||||
expectTemporarilyDisabled();
|
||||
testingClient.testing().setTimeOffset(Collections.singletonMap("offset", String.valueOf(11)));
|
||||
testingClient.testing().setTimeOffset(Collections.singletonMap("offset", String.valueOf(42)));
|
||||
|
||||
loginInvalidPassword();
|
||||
expectPermanentlyDisabled();
|
||||
|
@ -703,7 +703,7 @@ public class BruteForceTest extends AbstractTestRealmKeycloakTest {
|
|||
loginInvalidPassword();
|
||||
loginInvalidPassword();
|
||||
expectTemporarilyDisabled();
|
||||
testingClient.testing().setTimeOffset(Collections.singletonMap("offset", String.valueOf(6)));
|
||||
testingClient.testing().setTimeOffset(Collections.singletonMap("offset", String.valueOf(21)));
|
||||
UserRepresentation user = adminClient.realm("test").users().search("test-user@localhost", 0, 1).get(0);
|
||||
Map<String, Object> status = adminClient.realm("test").attackDetection().bruteForceUserStatus(user.getId());
|
||||
assertEquals(1, status.get("numTemporaryLockouts"));
|
||||
|
|
Loading…
Reference in a new issue