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

        <tfoot id='4pHJy'></tfoot>
        <i id='4pHJy'><tr id='4pHJy'><dt id='4pHJy'><q id='4pHJy'><span id='4pHJy'><b id='4pHJy'><form id='4pHJy'><ins id='4pHJy'></ins><ul id='4pHJy'></ul><sub id='4pHJy'></sub></form><legend id='4pHJy'></legend><bdo id='4pHJy'><pre id='4pHJy'><center id='4pHJy'></center></pre></bdo></b><th id='4pHJy'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='4pHJy'><tfoot id='4pHJy'></tfoot><dl id='4pHJy'><fieldset id='4pHJy'></fieldset></dl></div>
      1. <small id='4pHJy'></small><noframes id='4pHJy'>

      2. <legend id='4pHJy'><style id='4pHJy'><dir id='4pHJy'><q id='4pHJy'></q></dir></style></legend>
        • <bdo id='4pHJy'></bdo><ul id='4pHJy'></ul>

        忽略 JWT 中的簽名

        Ignoring signature in JWT(忽略 JWT 中的簽名)

        <small id='EHxxm'></small><noframes id='EHxxm'>

        <i id='EHxxm'><tr id='EHxxm'><dt id='EHxxm'><q id='EHxxm'><span id='EHxxm'><b id='EHxxm'><form id='EHxxm'><ins id='EHxxm'></ins><ul id='EHxxm'></ul><sub id='EHxxm'></sub></form><legend id='EHxxm'></legend><bdo id='EHxxm'><pre id='EHxxm'><center id='EHxxm'></center></pre></bdo></b><th id='EHxxm'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='EHxxm'><tfoot id='EHxxm'></tfoot><dl id='EHxxm'><fieldset id='EHxxm'></fieldset></dl></div>

              <tbody id='EHxxm'></tbody>
          • <legend id='EHxxm'><style id='EHxxm'><dir id='EHxxm'><q id='EHxxm'></q></dir></style></legend>
          • <tfoot id='EHxxm'></tfoot>
                  <bdo id='EHxxm'></bdo><ul id='EHxxm'></ul>
                • 本文介紹了忽略 JWT 中的簽名的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時(shí)送ChatGPT賬號(hào)..

                  我有一個(gè)使用 OpenId Connect 的 Web 應(yīng)用程序.我創(chuàng)建了一個(gè)自簽名證書,但它仍未由 CA 簽名.如何忽略簽名驗(yàn)證?

                  I have an web application that is using OpenId Connect. I created a self signed certificate but it is still not signed by a CA. How can I ignore the signature validation?

                  這是我目前所擁有的:

                  SecurityToken validatedToken = null;
                  
                  var tokenHandler = new JwtSecurityTokenHandler {
                      Configuration = new SecurityTokenHandlerConfiguration {
                          CertificateValidator = X509CertificateValidator.None
                      },
                  };
                  
                  TokenValidationParameters validationParams =
                      new TokenValidationParameters()
                      {
                          ValidAudience = ConfigurationManager.AppSettings["Audience"],
                          ValidIssuer = ConfigurationManager.AppSettings["Issuer"],
                          AudienceValidator = AudienceValidator,
                          ValidateAudience = true,
                          ValidateIssuer = true
                      };
                  
                  return tokenHandler.ValidateToken(jwtToken, validationParams, out validatedToken);
                  

                  它會(huì)拋出以下異常:

                  IDX10500:簽名驗(yàn)證失敗.無法解決SecurityKeyIdentifier: 'SecurityKeyIdentifier (
                  IsReadOnly = False, 計(jì)數(shù) = 1, 子句[0] =System.IdentityModel.Tokens.NamedKeySecurityKeyIdentifierClause
                  ) ', 令牌:'{"typ":"JWT","alg":"RS256","kid":"issuer_rsaKey"}.{"iss":...

                  IDX10500: Signature validation failed. Unable to resolve SecurityKeyIdentifier: 'SecurityKeyIdentifier (
                  IsReadOnly = False, Count = 1, Clause[0] = System.IdentityModel.Tokens.NamedKeySecurityKeyIdentifierClause
                  ) ', token: '{"typ":"JWT","alg":"RS256","kid":"issuer_rsaKey"}.{"iss":...

                  推薦答案

                  不要忽略簽名,這很危險(xiǎn)!

                  即使您使用自簽名證書,您也可以使用公鑰進(jìn)行簽名驗(yàn)證.

                  Even if you use a self-signed certificate, you will be able to use the public key for signature validation.

                  由于您使用的是 OpenId Connect,因此您應(yīng)該能夠通過前往 /.well-known/jwks 獲取簽名證書的公鑰.

                  Since you are using OpenId Connect, you should be able to get the public key for your signing certificate by heading over to /.well-known/jwks.

                  然后您可以像這樣設(shè)置驗(yàn)證參數(shù):

                  Then you can setup your validation parameters like this:

                  var certificate = new X509Certificate2(Convert.FromBase64String(yourPublicKeyGoesHere));
                  
                  var validationParameters = new TokenValidationParameters { 
                      IssuerSigningTokens = new[] { new X509SecurityToken(certificate) }  
                  };
                  

                  之后,你可以調(diào)用ValidateToken:

                  SecurityToken token;
                  var claimsPrincipal = handler.ValidateToken(encodedToken, validationParameters, out token);
                  

                  您真的要忽略簽名嗎?

                  記住,如果你這樣做了,你怎么知道有人沒有篡改令牌內(nèi)的數(shù)據(jù)?您可以輕松解碼 base64 url?? 編碼的有效負(fù)載并更改主題.如果您在應(yīng)用程序中依賴它,您將遇到麻煩(提示:有人訪問其他人的數(shù)據(jù))

                  Remember, if you do, how do you know someone didn't tamper with the data inside the token? You could easily decode the base64 url encoded payload and change the subject. And if you rely on that in your application, you'll be in trouble (hint: someone accessing someone else data)

                  你真的,真的想忽略它嗎?

                  您可以使用 ReadToken 并跳過所有驗(yàn)證:

                  You can use ReadToken and just skip every validation there is:

                  var badJwt = new JwtSecurityTokenHandler()
                                   .ReadToken(encodedMaliciousToken) as JwtSecurityToken;
                  

                  不要這樣做,這是不好的做法.

                  這篇關(guān)于忽略 JWT 中的簽名的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  What are good algorithms for vehicle license plate detection?(車牌檢測(cè)有哪些好的算法?)
                  onClick event for Image in Unity(Unity中圖像的onClick事件)
                  Running Total C#(運(yùn)行總 C#)
                  Deleting a directory when clicked on a hyperlink with JAvascript.ASP.NET C#(單擊帶有 JAvascript.ASP.NET C# 的超鏈接時(shí)刪除目錄)
                  asp.net listview highlight row on click(asp.net listview 在單擊時(shí)突出顯示行)
                  Calling A Button OnClick from a function(從函數(shù)調(diào)用按鈕 OnClick)

                  <small id='dGYsA'></small><noframes id='dGYsA'>

                          <tbody id='dGYsA'></tbody>
                        <i id='dGYsA'><tr id='dGYsA'><dt id='dGYsA'><q id='dGYsA'><span id='dGYsA'><b id='dGYsA'><form id='dGYsA'><ins id='dGYsA'></ins><ul id='dGYsA'></ul><sub id='dGYsA'></sub></form><legend id='dGYsA'></legend><bdo id='dGYsA'><pre id='dGYsA'><center id='dGYsA'></center></pre></bdo></b><th id='dGYsA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='dGYsA'><tfoot id='dGYsA'></tfoot><dl id='dGYsA'><fieldset id='dGYsA'></fieldset></dl></div>

                      1. <tfoot id='dGYsA'></tfoot>
                        <legend id='dGYsA'><style id='dGYsA'><dir id='dGYsA'><q id='dGYsA'></q></dir></style></legend>
                          <bdo id='dGYsA'></bdo><ul id='dGYsA'></ul>

                          • 主站蜘蛛池模板: 中文字幕人成乱码在线观看 | 久久久久国产一区二区三区四区 | 日韩在线资源 | 久久久久国产一区二区三区 | 在线一区| 一二三四av | 日韩在线欧美 | 精品亚洲一区二区三区四区五区 | japan25hdxxxx日本| 91av在线视频观看 | 欧美视频三区 | 国产精品日韩一区二区 | 午夜小视频在线播放 | 男女视频在线观看 | 午夜精品在线观看 | 二区在线视频 | 国产黄色大片 | 亚洲成av人影片在线观看 | 99精品国产一区二区三区 | 成人超碰 | 在线中文视频 | 99热热99| 色婷婷av久久久久久久 | 国产 欧美 日韩 一区 | 欧美日韩中文字幕 | 一区二区三区视频在线观看 | 欧美天堂在线 | av一二三四 | 欧美日韩高清在线观看 | av中文天堂| 国产成人精品在线 | 久久精品久久精品 | 99久久精品免费视频 | 亚洲 欧美 日韩 在线 | 56pao在线| 国产精品日本一区二区在线播放 | 久久亚洲一区二区三区四区 | 国产精品久久久久久二区 | 日韩成人精品一区 | 91精品国产一区二区在线观看 | 一区二区三区免费看 |