Search in sources :

Example 1 with KcVirtualAuthenticator

use of org.keycloak.testsuite.webauthn.authenticators.KcVirtualAuthenticator in project keycloak by keycloak.

the class VirtualAuthenticatorsManagerTest method addVirtualAuthenticator.

@Test
public void addVirtualAuthenticator() {
    final VirtualAuthenticatorManager manager = new VirtualAuthenticatorManager(driver);
    assertThat(manager, notNullValue());
    KcVirtualAuthenticator authenticator = useDefaultTestingAuthenticator(manager);
    assertAuthenticatorOptions(authenticator);
    manager.removeAuthenticator();
    assertThat(manager.getCurrent(), Matchers.nullValue());
    authenticator = useDefaultTestingAuthenticator(manager);
    assertAuthenticatorOptions(authenticator);
    manager.removeAuthenticator();
    assertThat(manager.getCurrent(), Matchers.nullValue());
}
Also used : KcVirtualAuthenticator(org.keycloak.testsuite.webauthn.authenticators.KcVirtualAuthenticator) VirtualAuthenticatorManager(org.keycloak.testsuite.webauthn.authenticators.VirtualAuthenticatorManager) Test(org.junit.Test)

Example 2 with KcVirtualAuthenticator

use of org.keycloak.testsuite.webauthn.authenticators.KcVirtualAuthenticator in project keycloak by keycloak.

the class VirtualAuthenticatorsManagerTest method differentDriver.

@Test
public void differentDriver() {
    final VirtualAuthenticatorManager manager = new VirtualAuthenticatorManager(driver);
    assertThat(manager, notNullValue());
    KcVirtualAuthenticator authenticator = useDefaultTestingAuthenticator(manager);
    assertThat(authenticator, notNullValue());
    assertThat(manager.getCurrent(), notNullValue());
    final VirtualAuthenticatorManager manager2 = new VirtualAuthenticatorManager(driver2);
    assertThat(manager2, notNullValue());
    assertThat(manager2.getCurrent(), nullValue());
}
Also used : KcVirtualAuthenticator(org.keycloak.testsuite.webauthn.authenticators.KcVirtualAuthenticator) VirtualAuthenticatorManager(org.keycloak.testsuite.webauthn.authenticators.VirtualAuthenticatorManager) Test(org.junit.Test)

Example 3 with KcVirtualAuthenticator

use of org.keycloak.testsuite.webauthn.authenticators.KcVirtualAuthenticator in project keycloak by keycloak.

the class VirtualAuthenticatorsManagerTest method overrideUsedAuthenticator.

@Test
public void overrideUsedAuthenticator() {
    final VirtualAuthenticatorManager manager = new VirtualAuthenticatorManager(driver);
    assertThat(manager, notNullValue());
    KcVirtualAuthenticator defaultTesting = useDefaultTestingAuthenticator(manager);
    assertAuthenticatorOptions(defaultTesting);
    assertThat(manager.getCurrent(), is(defaultTesting));
    VirtualAuthenticatorOptions defaultBleOptions = DefaultVirtualAuthOptions.DEFAULT_BLE.getOptions();
    assertThat(defaultBleOptions, notNullValue());
    KcVirtualAuthenticator defaultBLE = manager.useAuthenticator(defaultBleOptions);
    assertThat(defaultBLE, notNullValue());
    assertAuthenticatorOptions(defaultTesting);
    assertThat(manager.getCurrent(), is(defaultBLE));
    assertThat(manager.getCurrent().getOptions().clone(), is(defaultBleOptions));
}
Also used : KcVirtualAuthenticator(org.keycloak.testsuite.webauthn.authenticators.KcVirtualAuthenticator) VirtualAuthenticatorManager(org.keycloak.testsuite.webauthn.authenticators.VirtualAuthenticatorManager) VirtualAuthenticatorOptions(org.openqa.selenium.virtualauthenticator.VirtualAuthenticatorOptions) Test(org.junit.Test)

Example 4 with KcVirtualAuthenticator

use of org.keycloak.testsuite.webauthn.authenticators.KcVirtualAuthenticator in project keycloak by keycloak.

the class VirtualAuthenticatorsManagerTest method useDefaultTestingAuthenticator.

private static KcVirtualAuthenticator useDefaultTestingAuthenticator(VirtualAuthenticatorManager manager) {
    KcVirtualAuthenticator authenticator = manager.useAuthenticator(defaultTestingAuthenticatorOptions());
    assertThat(authenticator, notNullValue());
    assertThat(manager.getCurrent(), is(authenticator));
    return authenticator;
}
Also used : KcVirtualAuthenticator(org.keycloak.testsuite.webauthn.authenticators.KcVirtualAuthenticator)

Aggregations

KcVirtualAuthenticator (org.keycloak.testsuite.webauthn.authenticators.KcVirtualAuthenticator)4 Test (org.junit.Test)3 VirtualAuthenticatorManager (org.keycloak.testsuite.webauthn.authenticators.VirtualAuthenticatorManager)3 VirtualAuthenticatorOptions (org.openqa.selenium.virtualauthenticator.VirtualAuthenticatorOptions)1