简体   繁体   English

在两个不同的浏览器上使用 TouchID 进行 WebAuthn 身份验证和注册?

[英]WebAuthn authentication and registration using TouchID on two different browsers?

The case where a person registers a new account (via credentials.create ) and subsequently logs in using the same browser (via credentials.get ) is straightforward, because at the time credentials.create is called, the user must grant their browser permission to use Touch ID for a given domain.一个人注册一个新帐户(通过credentials.create )并随后使用同一个浏览器(通过credentials.get )登录的情况很简单,因为在调用credentials.create时,用户必须授予他们的浏览器权限对给定域使用 Touch ID。 For example, see the image below, which is a modal prompting the user to allow Touch ID on the given domain, triggered by credentials.create :例如,请参见下图,这是一个提示用户在给定域上允许 Touch ID 的模式,由credentials.create触发:

在此处输入图像描述

If you select "OK" in the modal shown above, you can complete registration with Touch ID.如果您在如上所示的模态中 select “OK”,则可以使用 Touch ID 完成注册。 When you subsequently login to your account using the same browser , you see the modal depicted below, which offers a choice between authenticating with a security key and the previously-registered Touch ID.当您随后使用同一浏览器登录您的帐户时,您会看到下图所示的模式,它提供了使用安全密钥和之前注册的 Touch ID 进行身份验证之间的选择。 This modal is triggered by credentials.get :此模式由credentials.get触发:

在此处输入图像描述

Here's the rub: If a user creates an account ( credentials.create ) with Touch ID via another browser, for example Chrome, and then attempts to authenticate ( credentials.get ) on Safari, Safari thinks they only have access to a security key, and does not provide Touch ID as an option.这就是问题所在:如果用户通过另一个浏览器(例如 Chrome)创建了一个带有 Touch ID 的帐户( credentials.create ),然后尝试在 Safari 上进行身份验证( credentials.get ),Safari 认为他们只能访问安全密钥,并且不提供 Touch ID 作为选项。 See below for reference:请参阅以下内容以供参考:

在此处输入图像描述

Is this a known limitation of WebAuthn itself?这是 WebAuthn 本身的已知限制吗? It is common that people would use different browsers to access the same website, with the expectation that they can login on any browser, regardless of the one they used to create an account.人们通常会使用不同的浏览器访问同一个网站,期望他们可以在任何浏览器上登录,而不管他们用来创建帐户的浏览器是什么。 Given that, it is troubling if WebAuthn does not support this behavior.鉴于此,如果 WebAuthn 不支持这种行为,那就很麻烦了。

Most importantly - how are devs getting around this issue?最重要的是 - 开发人员如何解决这个问题? Are you informing users that they are tied not only to the internal device that they originally registered to their account but also the browser they used?您是否通知用户他们不仅与他们最初注册到其帐户的内部设备相关联,还与他们使用的浏览器相关联? Are you calling credentials.create immediately before credentials.get ?您是在credentials.get credentials.create This seems like a hack but I am interested in any solutions.这似乎是一个 hack,但我对任何解决方案都感兴趣。

Thanks very much in advance.首先十分感谢。

Is this a known limitation of WebAuthn itself?这是 WebAuthn 本身的已知限制吗?

This has nothing to do with WebAuthn the API and everything to do with macOS.这与 WebAuthn API 和 macOS无关 To date macOS is the one platform that requires WebAuthn credential management to take into account which browser the credential was registered in .迄今为止,macOS 是唯一一个需要 WebAuthn 凭证管理来考虑凭证是在哪个浏览器中注册的平台

...how are devs getting around this issue? ...开发人员如何解决这个问题?

One way to address this is to store the user's OS and browser at registration (via traditional user agent, the newer navigator.userAgentData , etc...) with the new credential.解决此问题的一种方法是在注册时(通过传统用户代理、较新的navigator.userAgentData等)使用新凭据存储用户的操作系统和浏览器。 Then, at auth, grab the user's current OS and browser info and use it to filter credentials to include in allowCredentials that you'll pass to navigator.credentials.get() .然后,在 auth 中,获取用户当前的操作系统和浏览器信息,并使用它来过滤凭据以包含在您将传递给navigator.credentials.get()allowCredentials中。 If a credential was registered on macOS then filter by browser too;如果在 macOS 上注册了凭据,则也按浏览器过滤; on other platforms you can simply filter by OS.在其他平台上,您可以简单地按操作系统过滤。

If allowCredentials is empty on macOS after filtering the user's credentials (ie because the user has a single credential that was registered in Safari but the user is currently using Chrome) you need to handle that and prompt the user to log in some other way before prompting them to register Touch ID in Chrome.如果在过滤用户凭据后在 macOS 上allowCredentials为空(即因为用户有一个在 Safari 中注册但用户当前正在使用 Chrome 的单个凭据),您需要处理该问题并在提示之前提示用户以其他方式登录他们在 Chrome 中注册 Touch ID。

This is incredibly annoying to deal with, but it's the reality of WebAuthn on macOS.处理这非常烦人,但这是 macOS 上 WebAuthn 的现实。 Fingers crossed Apple's passkeys (now in Tech Preview on Monterey) will offer a similar experience to iOS' OS-level credential store once it rolls out more widely...手指越过 Apple 的密钥(现在在 Monterey 的技术预览中)一旦更广泛地推出,将提供与 iOS 的操作系统级凭据存储类似的体验……

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM