use of org.openqa.selenium.virtualauthenticator.VirtualAuthenticatorOptions in project keycloak by keycloak.
the class WebAuthnTransportLocaleTest method assertLocalizationIndividual.
private void assertLocalizationIndividual(VirtualAuthenticatorOptions options, String originalName, String localizedText) {
final Consumer<String> checkTransportName = (requiredName) -> {
WebAuthnAuthenticatorsList authenticators = webAuthnLoginPage.getAuthenticators();
assertThat(authenticators, notNullValue());
assertThat(authenticators.getCount(), is(1));
assertThat(authenticators.getLabels(), Matchers.contains("authenticator#1"));
List<WebAuthnAuthenticatorsList.WebAuthnAuthenticatorItem> items = authenticators.getItems();
assertThat(items, notNullValue());
assertThat(items.size(), is(1));
WebAuthnAuthenticatorsList.WebAuthnAuthenticatorItem item = items.get(0);
assertThat(item, notNullValue());
assertThat(item.getTransport(), is(requiredName));
};
try (Closeable c = setLocalesUpdater(Locale.ENGLISH.getLanguage(), "cs").update()) {
getWebAuthnManager().useAuthenticator(options);
addWebAuthnCredential("authenticator#1");
final int webAuthnCount = webAuthnCredentialType.getUserCredentialsCount();
assertThat(webAuthnCount, is(1));
setUpWebAuthnFlow("webAuthnFlow");
logout();
signingInPage.navigateTo();
loginToAccount();
webAuthnLoginPage.assertCurrent();
checkTransportName.accept(originalName);
webAuthnLoginPage.openLanguage("Čeština");
checkTransportName.accept(localizedText);
webAuthnLoginPage.clickAuthenticate();
signingInPage.assertCurrent();
} catch (IOException e) {
throw new RuntimeException("Cannot update locale.", e);
}
}
use of org.openqa.selenium.virtualauthenticator.VirtualAuthenticatorOptions in project keycloak by keycloak.
the class UserVerificationRegisterTest method assertUserVerification.
private void assertUserVerification(boolean shouldSuccess, UserVerificationRequirement requirement, Consumer<VirtualAuthenticatorOptions> authenticator) {
VirtualAuthenticatorOptions options = getDefaultAuthenticatorOptions();
authenticator.accept(options);
getVirtualAuthManager().useAuthenticator(options);
WaitUtils.pause(200);
try (Closeable u = getWebAuthnRealmUpdater().setWebAuthnPolicyUserVerificationRequirement(requirement.getValue()).update()) {
WebAuthnRealmData realmData = new WebAuthnRealmData(testRealm().toRepresentation(), isPasswordless());
assertThat(realmData.getUserVerificationRequirement(), containsString(requirement.getValue()));
registerDefaultUser(shouldSuccess);
displayErrorMessageIfPresent();
assertThat(webAuthnErrorPage.isCurrent(), is(!shouldSuccess));
} catch (IOException e) {
throw new RuntimeException(e.getCause());
}
}
use of org.openqa.selenium.virtualauthenticator.VirtualAuthenticatorOptions 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));
}
use of org.openqa.selenium.virtualauthenticator.VirtualAuthenticatorOptions 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));
}
Aggregations