如何在 Karate 中为 Chrome 中的浏览器 webAuthn 添加 virtualAuthenticator

问题描述 投票:0回答:1

我想使用空手道使用虚拟身份验证器来测试 Webauthn 密钥流程。这样它就可以自动化并且不需要实际的身份验证。

karate webauthn webauthenticator
1个回答
0
投票

您可以简单地与 chrome devtools 交互来设置虚拟身份验证器。

Karate 有这个能力 DevTools 协议提示

以下是使用虚拟身份验证器的 webatuhn.io 的简单功能文件。

Feature: Authentication success flow for FIDO.

  Background:
    * configure driver = { type: 'chrome', showDriverLog: true }

  Scenario:  Verify authentication is successful
    Given driver 'https://webauthn.io/'
    *  driver.send({ method: 'WebAuthn.enable' })
    * driver.send({ method: 'WebAuthn.addVirtualAuthenticator', params: { options: {"protocol": 'ctap2', "transport": 'internal', "hasUserVerification": true,  "isUserVerified": true,  "hasResidentKey": true  }}})

    And input('#input-email', 'dummy')
    And click('#register-button')
    // wait here for a second or two
    And click('#login-button')

这种方法可能只适用于 Chrome,我还没有进一步探索。只是想如果有人需要的话添加这个。

© www.soinside.com 2019 - 2024. All rights reserved.