Beispiel #1
0
def create_rk_enabled_u2f_authenticator(driver) -> WebDriver:

    options = VirtualAuthenticatorOptions()
    options.protocol = VirtualAuthenticatorOptions.Protocol.U2F
    options.has_resident_key = True
    driver.add_virtual_authenticator(options)
    return driver
Beispiel #2
0
def create_rk_enabled_authenticator(driver) -> WebDriver:
    options = VirtualAuthenticatorOptions()
    options.protocol = VirtualAuthenticatorOptions.Protocol.CTAP2
    options.has_resident_key = True
    options.has_user_verification = True
    options.is_user_verified = True
    driver.add_virtual_authenticator(options)
    return driver
Beispiel #3
0
def create_rk_disabled_ctap2_authenticator(driver) -> WebDriver:
    options = VirtualAuthenticatorOptions()
    options.protocol = VirtualAuthenticatorOptions.Protocol.CTAP2
    options.transport = VirtualAuthenticatorOptions.Transport.USB
    options.has_resident_key = False
    options.has_user_verification = True
    options.is_user_verified = True
    driver.add_virtual_authenticator(options)
    return driver
Beispiel #4
0
def test_full_virtual_authenticator(driver):

    options = VirtualAuthenticatorOptions()
    options.is_user_consenting = True
    options.protocol = VirtualAuthenticatorOptions.Protocol.U2F
    options.transport = VirtualAuthenticatorOptions.Transport.USB

    driver.add_virtual_authenticator(options)

    driver.get("https://webauthn.io/")
    username = driver.find_element(By.ID, "input-email")
    username.send_keys("username")

    selectAttestation = Select(driver.find_element(By.ID,
                                                   "select-attestation"))
    selectAttestation.select_by_visible_text("Direct")

    selectAuthenticator = Select(
        driver.find_element(By.ID, "select-authenticator"))
    selectAuthenticator.select_by_value("cross-platform")

    driver.find_element(By.ID, "register-button").click()

    login = driver.find_element(By.ID, "login-button")
    WebDriverWait(driver, 50).until(
        lambda x: x.find_element(By.ID, "login-button").is_displayed())
    login.click()

    WebDriverWait(driver, 40).until(
        lambda x: x.find_element(By.CLASS_NAME, "col-lg-12").is_displayed())

    source: str = driver.page_source

    if "You're logged in!" in source:
        assert True
    else:
        assert False