青岛啤酒节是什么时候| 第一次见面送女生什么花| 血小板异常是什么原因| 粘膜充血水肿什么意思| 尼哥是什么意思| 脾胃虚寒吃什么食物好| 壁虎是什么类动物| 月例是什么意思| 肛门湿疹用什么药| 什么是睡眠障碍| 老鳖吃什么| 甲鱼吃什么的| 四不像是指什么动物| 梦见丧尸是什么预兆| 什么是肺部腺性肿瘤| 什么水果可以解酒| 4a是什么意思| 射精太快吃什么好| 无垢是什么意思| 瑞舒伐他汀钙片治什么病| 鸡鸣寺求什么| 李子什么季节成熟| 二甲双胍不能和什么药一起吃| 4朵玫瑰代表什么意思| 什么的爱| 拉屎特别臭是什么原因| 黄色配什么颜色最好看| 股票五行属什么| 长目飞耳是什么动物| 下午5点到7点是什么时辰| 六月五号是什么星座| 戊肝抗体igg阳性是什么意思| 梦见蛇和老鼠是什么意思| 四查十对的内容是什么| 10月底是什么星座| 拔完火罐要注意什么| 五六点是什么时辰| 肚子疼是什么原因引起的| 胎盘血池是什么意思| 吃鱼对身体有什么好处| 大便次数多吃什么药| 殊途同归是什么意思| 猫喜欢吃什么| 感冒有黄痰是什么原因| 头部MRI检查是什么意思| 速度是70迈心情是自由自在什么歌| 宝宝睡觉突然大哭是什么原因| 为什么会放屁| 仙人板板 是什么意思| ab型血为什么容易得精神病| 为什么下巴经常长痘痘| 手起皮是什么原因| 姓蔡的女孩起什么名字| 烟火气息是什么意思| 4090是什么意思| 血小板太高会导致什么| meq是什么单位| 牛牛是什么| 孕期不能吃什么| 心动过速是什么原因| 汪星是什么意思| 形体是什么意思| 结婚32年是什么婚| 葡萄胎是什么原因造成的| 反流性食管炎b级是什么意思| 骨量是什么意思| 老感冒是什么原因| 肛门坠胀是什么原因| 益生元和益生菌有什么区别| 做妇科检查前需要注意什么| 阴道放气是什么原因| 母亲节可以做什么礼物| 丰盈是什么意思| 胶原蛋白是什么东西| 血糖高喝什么稀饭好| 舌苔厚腻吃什么中成药| 四肢无力是什么原因| 长期便秘是什么原因引起的| 柿子什么季节成熟| 青少年流鼻血是什么原因引起的| 狗为什么会吐| 子五行属什么| 活佛是什么意思呀| 甲状腺结节有什么感觉| 白羊跟什么星座最配| 支气管哮喘吃什么药| 酶是什么| 鸡胸挂什么科| 脚踩棉花感见于什么病| 针眼是什么原因引起的| 玉髓什么颜色最贵| hb是什么| 人造棉是什么面料| 吃什么补羊水最快| 做什么生意挣钱| 尿液检查白细胞高是什么原因| 双性是什么意思| 正觉是什么意思| 晚上老咳嗽是什么原因| 阿莫西林有什么作用| 猪肝能钓什么鱼| 精神伴侣是什么意思| 雌二醇过高是什么原因| 减肥吃什么东西| 男人染上霉菌什么症状| 2 26是什么意思| 打佛七什么意思| 白衬衫配什么裤子好看| 学考是什么意思| 不堪一击是什么意思| 肠粘连是什么原因引起| 盆腔积液用什么药| 捐精有什么要求| mido手表什么牌子| 血糖高喝什么好| 梦见给死人烧纸钱是什么意思| 梦见吃雪糕是什么意思| 月经结束一周后又出血是什么原因| 二月春风似剪刀的上一句是什么| 喝酒吐血是什么原因| 2月9日什么星座| hpv有什么危害| 肝肾挂什么科| 神态是什么意思| 什么叫阴阳水| 白细胞减少吃什么药| 南通有什么特产| 什么是素数| 2月2号是什么星座| 什么化妆品好用哪个牌子的| 今年66岁属什么生肖的| 心脏属于什么系统| 9527是什么意思| 脆哨是什么| 什么叫三叉神经痛| 梦到自己长白头发是什么意思| 肚子饿了为什么会叫| 丹凤朝阳什么意思| 低密度脂蛋白高有什么危害| 我宣你是什么意思| 谨言是什么意思| 茼蒿不能和什么一起吃| 壮的偏旁叫什么名字| 用什么| 请辞是什么意思| 水瓶座什么象| 疝气嵌顿是什么意思| 神经疼吃什么药| lining是什么意思| 复出是什么意思| 外传是什么意思| acne是什么意思| 痔疮出血用什么药| 属狗的是什么命| 金陵十三钗是什么意思| 上火喝什么| 什么食物可以降血糖| 梦见火是什么预兆| 喝山楂水有什么功效与作用| 血钾查什么项目| 肛门里面痒是什么情况| 什么生肖最旺鸡| 欧巴桑是什么意思| 空调干燥是什么意思| 大便出血吃什么药好得快| 人流需要准备什么东西| 为什么叫犹太人| 学习机什么牌子好| 字号是什么意思| 扁桃体经常发炎是什么原因| 眼袋肿是什么原因| hvp是什么| 大姨妈一直不干净是什么原因| 无机磷偏低有什么影响| 哮喘吃什么药管用| 金丝皇菊有什么功效| 痤疮吃什么药| 午餐肉炒什么菜好吃| bdsm什么意思| 月经头疼是什么原因| 梦见奶奶去世预示什么| 双手脱皮是什么原因引起的| 吃阿莫西林过敏有什么症状| 妨夫痣是什么意思| 害喜是什么意思| 什么原因导致阴虚| 内热吃什么药清热解毒| 东北和山东有什么区别| uno是什么| 散光看东西是什么样的| 御是什么意思| 正常的月经是什么颜色| 智齿旁边的牙齿叫什么| 社保缴费基数什么意思| 剪切是什么意思| 母亲节要送什么礼物| 沙眼衣原体是什么| 重中之重是什么意思| 什么是生辰八字| 蘑菇炒什么好吃| 壁虎怕什么| 三项规定内容是什么| 什么是川崎病| 震撼的意思是什么| 作祟是什么意思| spi是什么意思| 大脑精神紊乱什么病| 孕晚期白细胞高是什么原因| 眼睛变红了是什么原因| 腱鞘炎是什么| 结婚有什么好处| 口水臭什么原因| 黄金桂是什么茶| 什么东西蛋白质含量高| 什么是血脂高| sec是什么单位| 肚子胀恶心想吐是什么原因| 人授后吃什么容易着床| 宝宝吃什么鱼比较好| 院士是什么级别| 上海五行属什么| 早上吃鸡蛋有什么好处| 右耳朵疼是什么原因| 纳豆是什么豆| 大修基金什么时候缴纳| 虚火旺吃什么去火最快| 博物馆里面有什么| 什么是纯净水| 什么时候验孕最准确| 流水生财是什么意思| 意味深长是什么意思| 鸡子是什么东西| 午五行属什么| 雅诗兰黛是什么档次| 幽门阳性是什么意思| 一什么马车| 油嘴滑舌是什么意思| 生理性囊肿是什么意思| 什么族不吃猪肉| 712什么星座| 肝右叶低密度灶是什么意思| 脸上长粉刺是什么原因| 红细胞压积偏高是什么原因| 圣罗兰为什么叫杨树林| 梦见买苹果是什么征兆| 桔子什么时候成熟| 孩子上火吃什么药| 宰相的宰最早指什么| 什么是老赖| 跑步配速什么意思| dhea是什么药| 芒果对身体有什么好处| 毒龙什么意思| 肾盂肾炎吃什么药好| 多汗症挂什么科| 鑫字属于五行属什么| 鸡属相和什么属相最配| 无痛人流和普通人流有什么区别| 吃什么保养皮肤| 女人左眼皮跳是什么预兆| 静脉曲张有什么危害| 什么星空| 1976年是什么命| 杨梅有什么好处| 百度Jump to content

全国人大代表金进尧:将“两会精神”带进车间

From Wikipedia, the free encyclopedia
百度 如上述坚果营养成分表中的脂肪含量为克/100克,这里的克对于我们人体来说,是高了还是低了,消费者可能无法知道。

JSON Web Token
AbbreviationJWT
StatusProposed Standard
First publishedDecember 28, 2010 (2025-08-06)
Latest versionRFC 7519
May 2015
OrganizationIETF
CommitteeIEGS
Authors
Base standards
DomainData exchange
Websitedatatracker.ietf.org/doc/html/rfc7519

JSON Web Token (JWT, suggested pronunciation /d??t/, same as the word "jot"[1]) is a proposed Internet standard for creating data with optional signature and/or optional encryption whose payload holds JSON that asserts some number of claims. The tokens are signed either using a private secret or a public/private key.

For example, a server could generate a token that has the claim "logged in as administrator" and provide that to a client. The client could then use that token to prove that it is logged in as admin. The tokens can be signed by one party's private key (usually the server's) so that any party can subsequently verify whether the token is legitimate. If the other party, by some suitable and trustworthy means, is in possession of the corresponding public key, they too are able to verify the token's legitimacy. The tokens are designed to be compact,[2] URL-safe,[3] and usable, especially in a web-browser single-sign-on (SSO) context. JWT claims can typically be used to pass identity of authenticated users between an identity provider and a service provider, or any other type of claims as required by business processes.[4][5]

JWT relies on other JSON-based standards: JSON Web Signature and JSON Web Encryption.[1][6][7]

Structure

[edit]
Header
Identifies which algorithm is used to generate the signature. In the below example, HS256 indicates that this token is signed using HMAC-SHA256.
Typical cryptographic algorithms used are HMAC with SHA-256 (HS256) and RSA signature with SHA-256 (RS256). JWA (JSON Web Algorithms) RFC 7518 introduces many more for both authentication and encryption.[8]
{
  "alg": "HS256",
  "typ": "JWT"
}
Payload
Contains a set of claims. The JWT specification defines seven Registered Claim Names, which are the standard fields commonly included in tokens.[1] Custom claims are usually also included, depending on the purpose of the token.
This example has the standard Issued At Time claim (iat) and a custom claim (loggedInAs).
{
  "loggedInAs": "admin",
  "iat": 1422779638
}
Signature
Securely validates the token. The signature is calculated by encoding the header and payload using Base64url Encoding RFC 4648 and concatenating the two together with a period separator. That string is then run through the cryptographic algorithm specified in the header. This example uses HMAC-SHA256 with a shared secret (public key algorithms are also defined). The Base64url Encoding is similar to base64, but uses different non-alphanumeric characters and omits padding.
HMAC_SHA256(
  secret,
  base64urlEncoding(header) + '.' +
  base64urlEncoding(payload)
)

The three are encoded separately using Base64url Encoding RFC 4648, and concatenated using periods to produce the JWT:

const token = base64urlEncoding(header) + '.' + base64urlEncoding(payload) + '.' + base64urlEncoding(signature)

The above data and the secret of "secretkey" creates the token:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb2dnZWRJbkFzIjoiYWRtaW4iLCJpYXQiOjE0MjI3Nzk2Mzh9.gzSraSYS8EXBxLN _oWnFSRgCzcmJmMjLiuyu5CSpyHI=

(The above json strings are formatted without newlines or spaces, into utf-8 byte arrays. This is important as even slight changes in the data will affect the resulting token)

This resulting token can be easily passed into HTML and HTTP.[3]

Use

[edit]

In authentication, when a user successfully logs in, a JSON Web Token (JWT) is often returned. This token should be sent to the client using a secure mechanism like an HTTP-only cookie. Storing the JWT locally in browser storage mechanisms like local or session storage is discouraged. This is because JavaScript running on the client-side (including browser extensions) can access these storage mechanisms, exposing the JWT and compromising security. For unattended processes, the client may also authenticate directly by generating and signing its own JWT with a pre-shared secret and pass it to a OAuth compliant service like so:

POST /oauth2/token
Content-type: application/x-www-form-urlencoded

grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=eyJhb...

If the client passes a valid JWT assertion the server will generate an access_token valid for making calls to the application and pass it back to the client:

{
  "access_token": "eyJhb...",
  "token_type": "Bearer",
  "expires_in": 3600
}

When the client wants to access a protected route or resource, the user agent should send the JWT, typically in the Authorization HTTP header using the Bearer schema. The content of the header might look like the following:

Authorization: Bearer eyJhbGci...<snip>...yu5CSpyHI

This is a stateless authentication mechanism as the user state is never saved in server memory. The server's protected routes will check for a valid JWT in the Authorization header, and if it is present, the user will be allowed to access protected resources. As JWTs are self-contained, all the necessary information is there, reducing the need to query the database multiple times.

Standard fields

[edit]
Code Name Description
Standard claim fields The internet drafts define the following standard fields ("claims") that can be used inside a JWT claim set.
iss Issuer Identifies principal that issued the JWT.
sub Subject Identifies the subject of the JWT.
aud Audience Identifies the recipients that the JWT is intended for. Each principal intended to process the JWT must identify itself with a value in the audience claim. If the principal processing the claim does not identify itself with a value in the aud claim when this claim is present, then the JWT must be rejected.
exp Expiration Time Identifies the expiration time on and after which the JWT must not be accepted for processing. The value must be a NumericDate:[9] either an integer or decimal, representing seconds past 2025-08-06 00:00:00Z.
nbf Not Before Identifies the time on which the JWT will start to be accepted for processing. The value must be a NumericDate.
iat Issued at Identifies the time at which the JWT was issued. The value must be a NumericDate.
jti JWT ID Case-sensitive unique identifier of the token even among different issuers.
Commonly-used header fields The following fields are commonly used in the header of a JWT
typ Token type If present, it must be set to a registered IANA Media Type.
cty Content type If nested signing or encryption is employed, it is recommended to set this to JWT; otherwise, omit this field.[1]
alg Message authentication code algorithm The issuer can freely set an algorithm to verify the signature on the token. However, some supported algorithms are insecure.[10]
kid Key ID A hint indicating which key the client used to generate the token signature. The server will match this value to a key on file in order to verify that the signature is valid and the token is authentic.
x5c x.509 Certificate Chain A certificate chain in RFC4945 format corresponding to the private key used to generate the token signature. The server will use this information to verify that the signature is valid and the token is authentic.
x5u x.509 Certificate Chain URL A URL where the server can retrieve a certificate chain corresponding to the private key used to generate the token signature. The server will retrieve and use this information to verify that the signature is authentic.
crit Critical A list of headers that must be understood by the server in order to accept the token as valid
Code Name Description

List of currently registered claim names can be obtained from IANA JSON Web Token Claims Registry.[11]

Implementations

[edit]

JWT implementations exist for many languages and frameworks, including but not limited to:

Vulnerabilities

[edit]

JSON web tokens may contain session state. But if project requirements allow session invalidation before JWT expiration, services can no longer trust token assertions by the token alone. To validate that the session stored in the token is not revoked, token assertions must be checked against a data store. This renders the tokens no longer stateless, undermining the primary advantage of JWTs.[37]

Security consultant Tim McLean reported vulnerabilities in some JWT libraries that used the alg field to incorrectly validate tokens, most commonly by accepting a alg=none token. While these vulnerabilities were patched, McLean suggested deprecating the alg field altogether to prevent similar implementation confusion.[10] Still, new alg=none vulnerabilities are still being found in the wild, with four CVEs filed in the 2018-2021 period having this cause.[38][better source needed]

With proper design, developers can address algorithm vulnerabilities by taking precautions:[39][40]

  1. Never let the JWT header alone drive verification
  2. Know the algorithms (avoid depending on the alg field alone)
  3. Use an appropriate key size

Several JWT libraries were found to be vulnerable to an invalid Elliptic-curve attack in 2017.[41]

Some have argued that JSON web tokens are difficult to use securely due to the many different encryption algorithms and options available in the standard, and that alternate standards should be used instead for both web frontends[42] and backends.[43]

See also

[edit]

References

[edit]
  1. ^ a b c d Jones, Michael B.; Bradley, Bradley; Sakimura, Sakimura (May 2015). JSON Web Token (JWT). IETF. doi:10.17487/RFC7519. ISSN 2070-1721. RFC 7519.
  2. ^ Nickel, Jochen (2016). Mastering Identity and Access Management with Microsoft Azure. Packt Publishing. p. 84. ISBN 9781785887888. Retrieved July 20, 2018.
  3. ^ a b "JWT.IO - JSON Web Tokens Introduction". jwt.io. Retrieved July 20, 2018.
  4. ^ Sevilleja, Chris. "The Anatomy of a JSON Web Token". Retrieved May 8, 2015.
  5. ^ "Atlassian Connect Documentation". developer.atlassian.com. Archived from the original on May 18, 2015. Retrieved May 8, 2015.
  6. ^ Jones, Michael B.; Bradley, John; Sakimura, Nat (May 2015). "draft-ietf-jose-json-web-signature-41 - JSON Web Signature (JWS)". tools.ietf.org. Retrieved May 8, 2015.
  7. ^ Jones, Michael B.; Hildebrand, Joe (May 2015). "draft-ietf-jose-json-web-encryption-40 - JSON Web Encryption (JWE)". tools.ietf.org. Retrieved May 8, 2015.
  8. ^ Jones, Michael B. (May 2015). "draft-ietf-jose-json-web-algorithms-40 - JSON Web Algorithms (JWA)". tools.ietf.org. Retrieved May 8, 2015.
  9. ^ Jones, Michael B.; Bradley, Bradley; Sakimura, Sakimura (May 2015). ""exp" (Expiration Time) Claim". JSON Web Token (JWT). IETF. sec. 4.1.4. doi:10.17487/RFC7519. ISSN 2070-1721. RFC 7519.
  10. ^ a b McLean, Tim (March 31, 2015). "Critical vulnerabilities in JSON Web Token libraries". Auth0. Retrieved March 29, 2016.
  11. ^ "JSON Web Token (JWT)". IANA. January 23, 2015. Retrieved December 5, 2024.
  12. ^ jwt-dotnet on github.com
  13. ^ libjwt on github.com
  14. ^ "liquidz/clj-jwt". GitHub. Retrieved May 7, 2018.
  15. ^ cljwt on github.com
  16. ^ JustJWT on github.com
  17. ^ "bryanjos/joken". GitHub. Retrieved May 7, 2018.
  18. ^ "golang-jwt/jwt". GitHub. Retrieved January 8, 2018.
  19. ^ "jose: JSON Object Signing and Encryption (JOSE) and JSON Web Token (JWT) library". Hackage. Retrieved December 25, 2022.
  20. ^ auth0/java-jwt on github.com
  21. ^ "kjur/jsrsasign". GitHub. Retrieved May 7, 2018.
  22. ^ "SkyLothar/lua-resty-jwt". GitHub. Retrieved May 7, 2018.
  23. ^ "jsonwebtoken". npm. Retrieved May 7, 2018.
  24. ^ ocaml-jwt on github.com
  25. ^ Crypt::JWT on cpan.org
  26. ^ lcobucci/jwt on github.com
  27. ^ Egan, Morten (February 7, 2019), GitHub - morten-egan/jwt_ninja: PLSQL Implementation of JSON Web Tokens., retrieved March 14, 2019
  28. ^ "SP3269/posh-jwt". GitHub. Retrieved August 1, 2018.
  29. ^ "jpadilla/pyjwt". GitHub. Retrieved March 21, 2017.
  30. ^ net-jwt on pkgs.racket-lang.org
  31. ^ JSON-WebToken on github.com
  32. ^ ruby-jwt on github.com
  33. ^ jsonwebtoken on github.com
  34. ^ rust-jwt on github.com
  35. ^ jwt-scala on github.com
  36. ^ [1] on github.com
  37. ^ Slootweg, Sven. "Stop using JWT for sessions". joepie91 Ramblings. Retrieved August 1, 2018.
  38. ^ "CVE - Search Results". cve.mitre.org.
  39. ^ "Common JWT security vulnerabilities and how to avoid them". Retrieved May 14, 2018.
  40. ^ Andreas, Happe. "JWT: Signature vs MAC attacks". snikt.net. Retrieved May 27, 2019.
  41. ^ "Critical Vulnerability in JSON Web Encryption". Auth0 - Blog. Retrieved October 14, 2023.
  42. ^ "No Way, JOSE! Javascript Object Signing and Encryption is a Bad Standard That Everyone Should Avoid - Paragon Initiative Enterprises Blog". paragonie.com. Retrieved October 13, 2023.
  43. ^ "Pitfalls of JWT Authorization". authzed.com. Retrieved November 16, 2023.
  • RFC 7519
  • jwt.io – specialized website about JWT with tools and documentation, maintained by Auth0
512是什么节日 尿频尿不尽吃什么药 肩袖损伤吃什么药 眼窝凹陷是什么原因 imao什么意思
三级手术是什么意思 报销凭证是什么 脸大剪什么发型好看 记仇的人是什么性格 醪糟发酸是什么原因
操刀是什么意思 study是什么意思 治疗风湿有什么好方法 老公的弟弟叫什么 甲状腺不能吃什么
西瓜配什么榨汁好喝 hcv是什么病毒 平板和ipad有什么区别 年底是什么时候 女性的排卵期是什么时候
张力是什么意思hcv8jop2ns4r.cn 梅长苏结局是什么adwl56.com 精虫上脑什么意思hcv9jop2ns7r.cn 非你不可什么意思hcv7jop9ns1r.cn 7月18日是什么日子hcv8jop6ns6r.cn
什么止疼药见效最快hcv9jop5ns0r.cn 吥是什么意思hcv8jop1ns8r.cn 硝酸酯类药物有什么药hcv8jop6ns8r.cn 卖剑买牛是什么动物hcv8jop1ns1r.cn 什么是福报hcv8jop9ns7r.cn
女人能日到什么时候ff14chat.com 全飞秒手术是什么wmyky.com 心电轴不偏是什么意思hcv8jop9ns1r.cn gr是什么单位hcv9jop0ns9r.cn 上海是什么省zsyouku.com
女生右手食指戴戒指什么意思zsyouku.com 慢性支气管炎吃什么药hcv9jop0ns3r.cn 尿隐血是什么原因imcecn.com 枸杞不能和什么一起吃hcv8jop0ns0r.cn 1939年属什么sscsqa.com
百度