我有个疑问。我已经围绕Yubico U2F键设置了一个完整的解决方案。但现在,我不能停止为同一个应用程序id的用户重复注册相同的设备。当检查我的数据库中的键句柄时,它们为每个重复注册显示不同的值。请帮帮我。
发布于 2019-04-25 21:45:24
如果您使用的是WebAuthn接口,则在尝试使用'excludeCredentials‘密钥添加新密钥时,可以将所有已注册的密钥发送给客户端。这些凭据的格式与尝试登录时的格式相同。
excludeCredentials - 包含已向用户注册的凭据列表。
来源:https://medium.com/@herrjemand/introduction-to-webauthn-api-5fd1fb46c285
客户端在添加新密钥时收到的JSON示例如下:
{
"publicKey":{
"rp":{
"name":"YourApp",
"id":"YourAddress"
},
"authenticatorSelection":{
"userVerification":"preferred"
},
"user":{
"id":"UserId",
"name":"Username",
"displayName":"displayName"
},
"pubKeyCredParams":[
{
"type":"public-key",
"alg":-7
}
],
"attestation":"direct",
"extensions":{
"exts":true
},
"timeout":20000,
"challenge":"...",
"excludeCredentials":[
{
"id":"...",
"type":"public-key",
"transports":[
"usb",
"ble",
"nfc",
"internal"
]
},
{
"id":"...",
"type":"public-key",
"transports":[
"usb",
"ble",
"nfc",
"internal"
]
}
]
}
}https://stackoverflow.com/questions/54643120
复制相似问题