JWT(JSON Web Token)究竟是什么呢?它有什么用?这篇文章将为你揭开谜底。
首先,我们不妨看一下IETF(Internet Engineering Task Force)对JWT的权威定义:
JSON Web Token (JWT) is a compact, URL-safe means of representing claims to be transferred between two parties. The claims in a JWT are encoded as a JSON object that is used as the payload of a JSON Web Signature (JWS) structure or as the plaintext of a JSON Web Encryption (JWE) structure, enabling the claims to be digitally signed or integrity protected with a Message Authentication Code (MAC) and/or encrypted.
啊!什么鬼?! 水平有限,这样的定义我就不翻译了…
简单地说,JWT是一个字符串,我们在发起网络请求时,将其放在header或者url中,这样可以保证传递的数据被篡改时能被我们发现,保证安全性。
示例xxxxx.yyyyy.zzzzz即为JWT:
http://www.example.com/private/?token=xxxxx.yyyyy.zzzzz |
小伙伴应该注意到了,JWT由3部分组成,使用两个点区分。如下:
header.payload.signature |
Read full article from JWT究竟是什么呢? | KiwenLau
No comments:
Post a Comment