All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openqa.selenium.devtools.v85.webauthn.WebAuthn Maven / Gradle / Ivy

Go to download

Selenium automates browsers. That's it! What you do with that power is entirely up to you.

There is a newer version: 4.26.0
Show newest version
package org.openqa.selenium.devtools.v85.webauthn;

import org.openqa.selenium.Beta;
import org.openqa.selenium.devtools.Command;
import org.openqa.selenium.devtools.Event;
import org.openqa.selenium.devtools.ConverterFunctions;
import java.util.Map;
import java.util.LinkedHashMap;
import org.openqa.selenium.json.JsonInput;

/**
 * This domain allows configuring virtual authenticators to test the WebAuthn
 * API.
 */
@Beta()
public class WebAuthn {

    /**
     * Enable the WebAuthn domain and start intercepting credential storage and
     * retrieval with a virtual authenticator.
     */
    public static Command enable() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("WebAuthn.enable", Map.copyOf(params));
    }

    /**
     * Disable the WebAuthn domain.
     */
    public static Command disable() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("WebAuthn.disable", Map.copyOf(params));
    }

    /**
     * Creates and adds a virtual authenticator.
     */
    public static Command addVirtualAuthenticator(org.openqa.selenium.devtools.v85.webauthn.model.VirtualAuthenticatorOptions options) {
        java.util.Objects.requireNonNull(options, "options is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("options", options);
        return new Command<>("WebAuthn.addVirtualAuthenticator", Map.copyOf(params), ConverterFunctions.map("authenticatorId", org.openqa.selenium.devtools.v85.webauthn.model.AuthenticatorId.class));
    }

    /**
     * Removes the given authenticator.
     */
    public static Command removeVirtualAuthenticator(org.openqa.selenium.devtools.v85.webauthn.model.AuthenticatorId authenticatorId) {
        java.util.Objects.requireNonNull(authenticatorId, "authenticatorId is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("authenticatorId", authenticatorId);
        return new Command<>("WebAuthn.removeVirtualAuthenticator", Map.copyOf(params));
    }

    /**
     * Adds the credential to the specified authenticator.
     */
    public static Command addCredential(org.openqa.selenium.devtools.v85.webauthn.model.AuthenticatorId authenticatorId, org.openqa.selenium.devtools.v85.webauthn.model.Credential credential) {
        java.util.Objects.requireNonNull(authenticatorId, "authenticatorId is required");
        java.util.Objects.requireNonNull(credential, "credential is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("authenticatorId", authenticatorId);
        params.put("credential", credential);
        return new Command<>("WebAuthn.addCredential", Map.copyOf(params));
    }

    /**
     * Returns a single credential stored in the given virtual authenticator that
     * matches the credential ID.
     */
    public static Command getCredential(org.openqa.selenium.devtools.v85.webauthn.model.AuthenticatorId authenticatorId, java.lang.String credentialId) {
        java.util.Objects.requireNonNull(authenticatorId, "authenticatorId is required");
        java.util.Objects.requireNonNull(credentialId, "credentialId is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("authenticatorId", authenticatorId);
        params.put("credentialId", credentialId);
        return new Command<>("WebAuthn.getCredential", Map.copyOf(params), ConverterFunctions.map("credential", org.openqa.selenium.devtools.v85.webauthn.model.Credential.class));
    }

    /**
     * Returns all the credentials stored in the given virtual authenticator.
     */
    public static Command> getCredentials(org.openqa.selenium.devtools.v85.webauthn.model.AuthenticatorId authenticatorId) {
        java.util.Objects.requireNonNull(authenticatorId, "authenticatorId is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("authenticatorId", authenticatorId);
        return new Command<>("WebAuthn.getCredentials", Map.copyOf(params), ConverterFunctions.map("credentials", input -> input.readArray(org.openqa.selenium.devtools.v85.webauthn.model.Credential.class)));
    }

    /**
     * Removes a credential from the authenticator.
     */
    public static Command removeCredential(org.openqa.selenium.devtools.v85.webauthn.model.AuthenticatorId authenticatorId, java.lang.String credentialId) {
        java.util.Objects.requireNonNull(authenticatorId, "authenticatorId is required");
        java.util.Objects.requireNonNull(credentialId, "credentialId is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("authenticatorId", authenticatorId);
        params.put("credentialId", credentialId);
        return new Command<>("WebAuthn.removeCredential", Map.copyOf(params));
    }

    /**
     * Clears all the credentials from the specified device.
     */
    public static Command clearCredentials(org.openqa.selenium.devtools.v85.webauthn.model.AuthenticatorId authenticatorId) {
        java.util.Objects.requireNonNull(authenticatorId, "authenticatorId is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("authenticatorId", authenticatorId);
        return new Command<>("WebAuthn.clearCredentials", Map.copyOf(params));
    }

    /**
     * Sets whether User Verification succeeds or fails for an authenticator.
     * The default is true.
     */
    public static Command setUserVerified(org.openqa.selenium.devtools.v85.webauthn.model.AuthenticatorId authenticatorId, java.lang.Boolean isUserVerified) {
        java.util.Objects.requireNonNull(authenticatorId, "authenticatorId is required");
        java.util.Objects.requireNonNull(isUserVerified, "isUserVerified is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("authenticatorId", authenticatorId);
        params.put("isUserVerified", isUserVerified);
        return new Command<>("WebAuthn.setUserVerified", Map.copyOf(params));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy