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

    • <bdo id='MPXOt'></bdo><ul id='MPXOt'></ul>

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

    1. <small id='MPXOt'></small><noframes id='MPXOt'>

      <tfoot id='MPXOt'></tfoot>

      1. JwtSecurityTokenHandler 和 TokenValidationParameters

        JwtSecurityTokenHandler and TokenValidationParameters(JwtSecurityTokenHandler 和 TokenValidationParameters)

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

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

                  本文介紹了JwtSecurityTokenHandler 和 TokenValidationParameters的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我曾經引用過 Microsoft.IdentityModel.Tokens.JWT 并且一切正常.

                  I used to have a reference to Microsoft.IdentityModel.Tokens.JWT and everything was working fine.

                  我更新為使用新的 System.IdentityModel.Tokens.Jwt 但現在似乎沒有任何效果.找不到JwtSecurityTokenHandlerValidateToken方法,TokenValidationParameters沒有AllowedAudienceSigningTokenValidateExpiration 屬性.

                  I updated to use the new System.IdentityModel.Tokens.Jwt but nothing seems to work now. It cannot find the ValidateToken method of the JwtSecurityTokenHandler and the TokenValidationParameters have no AllowedAudience, SigningToken or ValidateExpiration properties.

                  我在這里缺少什么?任何人都可以提供一個 JWT 驗證的工作示例嗎?

                  What am I missing here? Can anyone provide with a working sample of a JWT validation with this?

                  我的舊"代碼:

                  private static void ValidateJwt(string jwt)
                  {
                      var handler = new JWTSecurityTokenHandler();
                      var validationParameters = new Microsoft.IdentityModel.Tokens.JWT.TokenValidationParameters()
                      {
                          AllowedAudience = "https://my-rp.com",
                          //SigningToken = new BinarySecretSecurityToken(Convert.FromBase64String(myBase64Key)),
                          SigningToken = new X509SecurityToken(
                             X509
                             .LocalMachine
                             .My
                             .Thumbprint
                             .Find("UYTUYTVV99999999999YTYYTYTY88888888", false)
                             .First()),
                          ValidIssuer = "https://my-issuer.com/trust/issuer",
                          ValidateExpiration = true
                      };
                  
                      try
                      {
                          var principal = handler.ValidateToken(jwt, validationParameters);
                      }
                      catch (Exception e)
                      {
                  
                          Console.WriteLine("{0}
                   {1}", e.Message, e.StackTrace);
                      }
                  
                      Console.WriteLine();
                  }
                  

                  推薦答案

                  經過大量研究和測試,我終于發現TokenValidationParameters的一些屬性名稱發生了變化,JwtSecurityTokenHandler.ValidateToken() 方法簽名.

                  After a lot of research and tests, I finally found that some properties names for TokenValidationParameters had changed and JwtSecurityTokenHandler.ValidateToken() method signature too.

                  所以這是上面代碼的修改后的工作版本.

                  So here's the modified working version of the above code.

                  private static void ValidateJwt(string jwt)
                  {
                      var handler = new JwtSecurityTokenHandler();   
                      var validationParameters = new TokenValidationParameters()
                      {
                          ValidAudience = "https://my-rp.com",
                          IssuerSigningTokens = new List<X509SecurityToken>() { new X509SecurityToken(
                             X509
                             .LocalMachine
                             .My
                             .Thumbprint
                             .Find("UYTUYTVV99999999999YTYYTYTY88888888", false)
                             .First()) },
                          ValidIssuer = "https://my-issuer.com/trust/issuer",
                          CertificateValidator = X509CertificateValidator.None,
                          RequireExpirationTime = true
                      };
                  
                      try
                      {
                          SecurityToken validatedToken;
                          var principal = handler.ValidateToken(jwt, validationParameters, out validatedToken);
                      }
                      catch (Exception e)
                      {
                  
                          Console.WriteLine("{0}
                   {1}", e.Message, e.StackTrace);
                      }
                  
                      Console.WriteLine();
                  }
                  

                  作為參考,JwtSecurityTokenHandler 位于 System.IdentityModel.Tokens 命名空間中.不要忘記為 Microsoft .Net 添加包JSON Web 令牌處理程序Framework 4.5"(我寫這些行時的版本 4.0.0).

                  And for the reference, the JwtSecurityTokenHandler lives in the System.IdentityModel.Tokens namespace. Don't forget to add the package "JSON Web Token Handler For the Microsoft .Net Framework 4.5" (version 4.0.0 at the time I write theses lines).

                  希望它可以為你們中的一些人節省幾個小時的搜索時間!

                  Hope it can save a few hours of search for some of you guys!

                  這篇關于JwtSecurityTokenHandler 和 TokenValidationParameters的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

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

                    <legend id='WWaBM'><style id='WWaBM'><dir id='WWaBM'><q id='WWaBM'></q></dir></style></legend>

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

                    • <bdo id='WWaBM'></bdo><ul id='WWaBM'></ul>

                        <i id='WWaBM'><tr id='WWaBM'><dt id='WWaBM'><q id='WWaBM'><span id='WWaBM'><b id='WWaBM'><form id='WWaBM'><ins id='WWaBM'></ins><ul id='WWaBM'></ul><sub id='WWaBM'></sub></form><legend id='WWaBM'></legend><bdo id='WWaBM'><pre id='WWaBM'><center id='WWaBM'></center></pre></bdo></b><th id='WWaBM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='WWaBM'><tfoot id='WWaBM'></tfoot><dl id='WWaBM'><fieldset id='WWaBM'></fieldset></dl></div>
                            <tbody id='WWaBM'></tbody>
                          1. 主站蜘蛛池模板: 91视频在线看 | 国产伦精品一区二区三毛 | 亚洲97| 天天色综 | 日韩中文一区二区三区 | 久久久www成人免费无遮挡大片 | 久久久久久综合 | 天天躁日日躁狠狠很躁 | 成人免费看黄网站在线观看 | 欧美成视频在线观看 | 99久久久国产精品免费消防器 | 久久久亚洲一区 | 国产精品一区二区av | 国产精品视频999 | 91一区二区三区在线观看 | 一区二区在线视频 | 久久久久久久电影 | 成人欧美一区二区三区视频xxx | 香蕉大人久久国产成人av | 一区在线视频 | 国产精品亚洲一区 | 亚洲视频免费在线观看 | 国产一区二区三区久久久久久久久 | 欧美一区二区三区在线 | 国产精品一区二区三级 | 成人精品视频99在线观看免费 | 夜夜夜操 | 日韩在线小视频 | 色狠狠一区 | 97日日碰人人模人人澡分享吧 | 国产精品成人在线播放 | 中文字幕亚洲精品 | 色婷婷久久久久swag精品 | 蜜桃av鲁一鲁一鲁一鲁 | 亚洲 欧美 激情 另类 校园 | 日韩欧美在线一区二区 | 成人免费一区二区三区牛牛 | 亚洲夜夜爽 | 中文字幕乱码一区二区三区 | 亚洲一区国产 | 成人免费视频网站在线观看 |