question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[🚀 Feature]: Add virtual authenticator support for all Selenium language bindings

See original GitHub issue

Feature and motivation

Applications often integrate WebAuthn as part of the login step. This triggers a WebAuthn browser-specific WebAuthn flow. Example of WebAuthn in Chrome: Screenshot 2022-04-13 at 6 02 36 PM

Automating interaction with the WebAuthn dialog, as shown above, is possible via the extension VirtualAuthenticator APIs defined as part of https://w3c.github.io/webauthn/#sctn-automation.

Implementation

Implementation for Java was added as part of https://github.com/SeleniumHQ/selenium/pull/7760 and https://github.com/SeleniumHQ/selenium/pull/7842. The rest of the language bindings need to add the relevant code and can refer to the Java implementation for guidance.

An outline of implementing VirtualAuthenticator

  1. VirtualAuthenticatorOptions (this is used when adding the VirtualAuthenticator)
  2. Credential (The credentials to be used by the VirtualAuthenticator)
  3. List of methods (which call the WebDriver commands) and the respective parameters required:

Tests are defined in https://github.com/SeleniumHQ/selenium/blob/trunk/java/test/org/openqa/selenium/virtualauthenticator/VirtualAuthenticatorTest.java

Note: Currently, only chromium-based browsers implement the WebAuthn APIs. Though Java does not do it, till the rest of the vendors implement it might be a good idea for the VirtualAuthenticator APIs to sit in the chromium section of each binding (similar to the current implementation of Permissions API).

C# It can follow the Java implementation since both are strongly typed. C# binding has similar interface declarations as Java for existing features (example: HasPermissions).

Ruby All extension APIs are defined in https://github.com/SeleniumHQ/selenium/tree/39dec028673260e8a9518898fe40a910426adc85/rb/lib/selenium/webdriver/common/driver_extensions. Similarly, has_virtualauthenticator interface can be implemented and added here and used in the chromium module.

Python Chromium-specific Selenium commands in python are in https://github.com/SeleniumHQ/selenium/blob/trunk/py/selenium/webdriver/chromium/webdriver.py VirtualAuthenticator commands can be added here and authentication id can be defined as a local variable.

Javascript Chromium-specific Selenium commands in javascript are in https://github.com/SeleniumHQ/selenium/blob/trunk/javascript/node/selenium-webdriver/chromium.js VirtualAuthenticator commands can be added here and authentication id can be defined as a local variable.

Usage example

A sample java example:

    WebDriver driver = new ChromeDriver();
   
    HasVirtualAuthenticator virtualAuthenticatorManager = ((HasVirtualAuthenticator) driver);

    VirtualAuthenticatorOptions options = new VirtualAuthenticatorOptions();
    options.setIsUserConsenting(true);
    options.setProtocol(VirtualAuthenticatorOptions.Protocol.U2F);
    options.setTransport(VirtualAuthenticatorOptions.Transport.USB);
    
    VirtualAuthenticator authenticator = virtualAuthenticatorManager.addVirtualAuthenticator(options);
    authenticator.setUserVerified(true);

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
SinghHrmncommented, May 4, 2022

Feature Update

Virtual Authenticator changes needs to be implemented in the common WebDriver Methods. Currently, only Chromium browsers [Edge/Chrome] support Virtual Authenticator stuff. By adding it in common, it will insure that Firefox/Safari changes are smooth.

Steps to Follow

  • Add a method that will check if the browser is Firefox or Safari and respond with a proper message like Virtual Authentication stuff is only available in chromium based browsers.
  • In Future if Firefox/Safari implement Virtual Authentication we’ll remove this check

See Example: https://github.com/SeleniumHQ/selenium/pull/10579

1reaction
symonkcommented, May 14, 2022

@titusfortner @SinghHrmn removed C-py here as to my understanding this is done as far as python is concerned

Read more comments on GitHub >

github_iconTop Results From Across the Web

Virtual Authenticator | Selenium
A Virtual Authenticatior has a set of properties. These properties are mapped as VirtualAuthenticatorOptions in the Selenium bindings.
Read more >
Automated testing with Selenium Web Driver in .NET
Selenium Web Driver is a popular tool used to automate the front-end testing of web applications. It uses drivers provided by various browsers...
Read more >
selenium-webdriver | Yarn - Package Manager
The official WebDriver JavaScript bindings from the Selenium project ... :rocket: New Feature. Add support for Selenium Manager to work with IE Driver ......
Read more >
https://raw.githubusercontent.com/SeleniumHQ/selen...
v4.5.0 #### :rocket: New Feature * Adds 'Select' support package ... updates npm packages * feat: Added virtual authenticator (#10663) ## v4.2.0 *...
Read more >
homebrew-core - Homebrew Formulae
a2ps 4.14 Any‑to‑PostScript filter aacgain 1.8 AAC‑supporting version of mp3gain aalib 1.4rc5 Portable ASCII art graphics library aamath 0.3 Renders mathematical expressions as ASCII art
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found