使用客户端指纹编码 JWT 令牌? [英] Use client fingerprint to encode JWT token?

查看:32
本文介绍了使用客户端指纹编码 JWT 令牌?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道使用客户端指纹作为 JWT-secret 进行编码是否是最佳实践.但是,我在 WWW 中找不到关于这个问题的任何内容,但到目前为止,我这样做是有意义的.

I'm wondering if it would be best practice to use a clients fingerprint as JWT-secret for encoding. However I couldn't find anything in the WWW concerning this question, but so far it makes sense to me to do it.

我正在考虑使用 JavaScript 生成指纹客户端,并在每次调用时将其发送到 API.然后,API 应将指纹与硬编码的秘密一起用于对令牌进行编码和解码.

I'm thinking about generating a fingerprint client-side with JavaScript and sent it to the API with every call. The API should then use the fingerprint with a hard coded secret together for encoding and decoding the token.

这不是防止CSRF的好方法吗?还是我错过了其他东西?或者一般来说:使用 JWT 防止 CSRF 的最佳方法是什么?(我正在使用 PHP 和 VueJS,是否有与案例相关的解决方案?)

Isn't this a good method to prevent CSRF? Or am I missing out on something else? Or in general: What is the best way to prevent CSRF with JWT? (I'm using PHP and VueJS, is there maybe a case related solution?)

推荐答案

我从未听说过.

令牌使用私钥或共享机密进行签名.使用指纹意味着您可以将一个(或多个)手指与私钥相关联,然后计算令牌.

A token is signed using a private key or a shared secret. The use of a fingerprint means you can correlate one (or more) fingers to a private key then compute a token.

但是,这看起来与我正在使用的Webauthn 协议非常相似.使用 Android 设备时,浏览器可以通过指纹/屏幕锁进行交互以对用户进行身份验证.设备发送的数据是可以使用 Google API 验证的 JWT(请参阅 Android 安全网).

However, this looks very similar to the Webauthn protocol I am working with. When using Android devices, the browser can interact with the fingerprint/screenlock to authenticate the user. The data sent by the device is a JWT that can be verified using a Google API (see Android SafetyNet).

这篇关于使用客户端指纹编码 JWT 令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆