久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

“秘密"應(yīng)該是什么?在智威湯遜?

What should be the quot;Secretquot; in JWT?(“秘密應(yīng)該是什么?在智威湯遜?)
本文介紹了“秘密"應(yīng)該是什么?在智威湯遜?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我打算將 JWT 應(yīng)用到我使用 Java-Jersey 開發(fā)的 REST API 中.我正在將此庫用于 JWT - https://github.com/auth0/java-jwt

我對 JWT - Secret 有幾個問題

  1. 這個 Secret 必須是唯一的嗎?
  2. 我應(yīng)該使用用戶密碼的散列版本來保密嗎?(那么無論如何它都不是唯一的)這是因為當用戶更改密碼時,他的令牌將自動失效.

解決方案

  1. 這個 Secret 必須是唯一的嗎?

它應(yīng)該是您的應(yīng)用程序獨有的 —畢竟它必須是一個秘密 —但它不會對每個令牌都是唯一的.相反,在任何給定時間,您都應(yīng)該擁有相對較少數(shù)量的密鑰(例如,通常只有一個密鑰,但在從一個密鑰輪換到另一個密鑰時,您會在短時間內(nèi)擁有兩個密鑰).

<塊引用>

  1. 我應(yīng)該使用哈希版本的用戶密碼作為密碼嗎?

不,有兩個原因:

  1. 假設(shè)您的用戶有一個相對不安全的密碼,例如 GoPackers123.然后,在您的秘密中使用密碼意味著有人可以輕松地測試給定的潛在密碼,看看它是否會產(chǎn)生正確的簽名;而且,更重要的是,他們可以輕松測試大量潛在密碼,看看其中是否有任何一個給出了正確的簽名.這是一次離線攻擊,因此您甚至都不會知道它發(fā)生了.
  2. 這將要求您將所有用戶的密碼哈希分發(fā)到每個需要保存密碼的系統(tǒng).如果您的用戶數(shù)量很少,這可能會對您的秘密分發(fā)機制造成相當嚴重的負擔.

I am going to apply JWT into my REST API developed using Java-Jersey. I am using this library for JWT - https://github.com/auth0/java-jwt

I have few questions about the JWT - Secret

  1. Does this Secret has to be unique?
  2. Shall I use the hashed version of user's password for secret? (Then it is not unique anyway) This is because then when user changed his password, his token will be automatically invalid.

解決方案

  1. Does this Secret has to be unique?

It should be unique to your application — it needs to be a secret, after all — but it won't be unique for each token. Rather, you should have a relatively small number of secret keys at any given time (e.g., usually having just one key, but having brief periods where you have two keys as you rotate from one to the next).

  1. Shall I use the hashed version of user's password for secret?

No, for two reasons:

  1. Suppose that your user has a relatively insecure password, like GoPackers123. Using the password in your secret then means that someone can easily test a given potential password to see if it results in the right signature; and, more to the point, they can easily test huge numbers of potential passwords to see if any of them gives the right signature. This is an offline attack, so you would never even know it happened.
  2. This would require you to distribute all of your users' password hashes to every system that needs to hold the secret. If you have more than a trivial number of users, this can become a pretty serious burden on your secret-distribution mechanism.

這篇關(guān)于“秘密"應(yīng)該是什么?在智威湯遜?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環(huán)繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數(shù)據(jù)庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 毛片一区二区三区 | 中文字幕av一区二区三区 | 国产成人精品a视频一区www | 伊人久久大香线 | 亚洲精品日韩在线观看 | 日韩欧美在线视频 | 国产99视频精品免视看9 | 一区二区三区免费在线观看 | 中文字幕在线一区二区三区 | 色综合美女 | 国产欧美在线观看 | 最新中文在线视频 | 视频一区二区在线观看 | 国产欧美日韩精品一区 | 亚洲日本欧美日韩高观看 | 一区二区精品 | 久久夜视频 | 精品亚洲一区二区三区 | 久久久久久久亚洲精品 | 亚洲视频观看 | 91免费在线 | 91资源在线播放 | 亚洲精品二区 | 久久中文免费视频 | 91精品国产高清一区二区三区 | 日本在线看片 | 国精产品一区二区三区 | 久久久久一区二区三区四区 | 欧美精品一区二区三区在线 | 国产精品视频一区二区三区 | 欧美男人天堂 | 国产精品成人一区二区三区 | 色婷婷综合久久久久中文一区二区 | 日日夜夜精品免费视频 | 青春草91 | 国产精品免费视频一区 | 久久亚洲一区 | 成人伊人| 精品国产免费一区二区三区五区 | 99久久久久久久 | 国产精品视频999 |