Search in sources :

Example 1 with VirtualAuthenticatorManager

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

the class AbstractWebAuthnVirtualTest method createDefaultVirtualManager.

public static VirtualAuthenticatorManager createDefaultVirtualManager(WebDriver webDriver, VirtualAuthenticatorOptions options) {
    VirtualAuthenticatorManager manager = new VirtualAuthenticatorManager(webDriver);
    manager.useAuthenticator(options);
    return manager;
}
Also used : VirtualAuthenticatorManager(org.keycloak.testsuite.webauthn.authenticators.VirtualAuthenticatorManager)

Example 2 with VirtualAuthenticatorManager

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

the class VirtualAuthenticatorsManagerTest method singleResponsibleAuthOptions.

@Test
public void singleResponsibleAuthOptions() {
    VirtualAuthenticatorOptions options = DefaultVirtualAuthOptions.DEFAULT_BLE.getOptions();
    options.setTransport(VirtualAuthenticatorOptions.Transport.NFC);
    final VirtualAuthenticatorManager manager = new VirtualAuthenticatorManager(driver);
    assertThat(manager, notNullValue());
    manager.useAuthenticator(options);
    assertThat(manager.getCurrent().getOptions().getTransport(), is(VirtualAuthenticatorOptions.Transport.NFC));
    options = DefaultVirtualAuthOptions.DEFAULT_BLE.getOptions();
    manager.useAuthenticator(options);
    assertThat(manager.getCurrent().getOptions().getTransport(), is(VirtualAuthenticatorOptions.Transport.BLE));
}
Also used : VirtualAuthenticatorManager(org.keycloak.testsuite.webauthn.authenticators.VirtualAuthenticatorManager) VirtualAuthenticatorOptions(org.openqa.selenium.virtualauthenticator.VirtualAuthenticatorOptions) Test(org.junit.Test)

Example 3 with VirtualAuthenticatorManager

use of org.keycloak.testsuite.webauthn.authenticators.VirtualAuthenticatorManager 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 4 with VirtualAuthenticatorManager

use of org.keycloak.testsuite.webauthn.authenticators.VirtualAuthenticatorManager 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 5 with VirtualAuthenticatorManager

use of org.keycloak.testsuite.webauthn.authenticators.VirtualAuthenticatorManager 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)

Aggregations

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