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

  • <small id='YLqQK'></small><noframes id='YLqQK'>

  • <tfoot id='YLqQK'></tfoot>
      <bdo id='YLqQK'></bdo><ul id='YLqQK'></ul>
    <legend id='YLqQK'><style id='YLqQK'><dir id='YLqQK'><q id='YLqQK'></q></dir></style></legend>

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

        使用 AspNet.Security.OpenIdConnect.Server (ASP.NET vNext) 的

        Custom Lifetime Validation With AspNet.Security.OpenIdConnect.Server (ASP.NET vNext)(使用 AspNet.Security.OpenIdConnect.Server (ASP.NET vNext) 的自定義生命周期驗證)
      1. <legend id='3hz5U'><style id='3hz5U'><dir id='3hz5U'><q id='3hz5U'></q></dir></style></legend>

            <small id='3hz5U'></small><noframes id='3hz5U'>

                <bdo id='3hz5U'></bdo><ul id='3hz5U'></ul>
                • <i id='3hz5U'><tr id='3hz5U'><dt id='3hz5U'><q id='3hz5U'><span id='3hz5U'><b id='3hz5U'><form id='3hz5U'><ins id='3hz5U'></ins><ul id='3hz5U'></ul><sub id='3hz5U'></sub></form><legend id='3hz5U'></legend><bdo id='3hz5U'><pre id='3hz5U'><center id='3hz5U'></center></pre></bdo></b><th id='3hz5U'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='3hz5U'><tfoot id='3hz5U'></tfoot><dl id='3hz5U'><fieldset id='3hz5U'></fieldset></dl></div>
                    <tbody id='3hz5U'></tbody>
                  <tfoot id='3hz5U'></tfoot>
                  本文介紹了使用 AspNet.Security.OpenIdConnect.Server (ASP.NET vNext) 的自定義生命周期驗證的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我正在使用 Visual Studio 2015 Enterprise Update 1 和 ASP.NET vNext rc1-update1 來發(fā)布和使用 JWT 令牌,如 這里.

                  I am using Visual Studio 2015 Enterprise Update 1 and ASP.NET vNext rc1-update1 to issue and consume JWT tokens as described here.

                  在我們的實現(xiàn)中,我們希望控制令牌生命周期驗證.

                  In our implementation we want to control token lifetime validation.

                  我們嘗試了幾種方法,所有這些方法都有不良副作用.例如,在一次嘗試中,我們在 Configure 方法中接管了 TokenValidationParameters.TokenValidationParameters.LifetimeValidator 事件:

                  We tried several approaches, all of which had undesirable side effects. For example in one attempt we took over the TokenValidationParameters.TokenValidationParameters.LifetimeValidator event in the Configure method:

                  app.UseJwtBearerAuthentication
                  (
                      options => 
                      {
                          options.TokenValidationParameters = new TokenValidationParameters()
                          {
                              LifetimeValidator = (DateTime? notBefore, DateTime? expires, SecurityToken securityToken, TokenValidationParameters validationParameters) =>
                              {
                                  // Pretend to do custom validation
                                  return false;
                              }
                          };
                      }
                  );
                  

                  該事件導致驗證失敗,但客戶端收到 500 錯誤,而我們希望返回 400 系列錯誤和一個小負載.

                  That event causes validation to fail as we'd like but the client receives a 500 error whereas we would like to return a 400-series error and a small payload instead.

                  在另一次嘗試中,我們嘗試了 TokenValidationParameters.Events 的各種實現(xiàn),例如檢查 ValidatedToken 事件中的聲明,但發(fā)現(xiàn)我們無法阻止中間件調(diào)用控制器操作,除非引發(fā)異常,導致我們回到 500 錯誤問題.

                  In another attempt we tried various implementations of TokenValidationParameters.Events, such as inspecting claims in the ValidatedToken event but found we were unable to prevent the middleware from invoking the controller action short of throwing an exception which got us back to the 500 error problem.

                  所以我的問題是:

                  • 使用 OIDC 接管生命周期驗證的最佳做法是什么?

                  • What what is the best practices for taking over lifetime validation with OIDC?

                  我們是否可以強制 OIDC 不在令牌中包含某些生命周期聲明,例如nbf",因為我們無論如何都不需要它們?

                  Can we force OIDC not to include certain lifetime claims in the token like "nbf" since we won't need them anyway?

                  推薦答案

                  此錯誤已在 ASP.NET Core RC2 中修復(fù).不再需要此答案中描述的解決方法.

                  這是一個已知錯誤.遺憾的是,您可以在 beta8 中使用的解決方法 不再有效 在 RC1 中.

                  It's a known bug. Sadly, the workaround you could use in beta8 no longer works in RC1.

                  您唯一的選擇是編寫一個捕獲異常的中間件,以防止服務(wù)器返回 500 響應(yīng).當然,它很丑陋,并且可能會隱藏重要的異常,但它是唯一適用于 RC1 的已知解決方法.

                  Your only option is to write a middleware catching the exception to prevent the server from returning a 500 response. Of course, it's ugly and will potentially hide important exceptions, but it's the only known workaround that works with RC1.

                  這是一個例子(確保在 JWT 承載中間件之前注冊它):

                  Here's an example (make sure to register it before the JWT bearer middleware):

                  app.Use(next => async context => {
                      try {
                          await next(context);
                      }
                  
                      catch {
                          // If the headers have already been sent, you can't replace the status code.
                          // In this case, throw an exception to close the connection.
                          if (context.Response.HasStarted) {
                              throw;
                          }
                  
                          context.Response.StatusCode = 401;
                      }
                  });
                  

                  這篇關(guān)于使用 AspNet.Security.OpenIdConnect.Server (ASP.NET vNext) 的自定義生命周期驗證的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  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(從函數(shù)調(diào)用按鈕 OnClick)
                  ASP.net C# Gridview ButtonField onclick event(ASP.net C# Gridview ButtonField onclick 事件)
                  Adding OnClick event to ASP.NET control(將 OnClick 事件添加到 ASP.NET 控件)
                  Multiple submit Button click problem?(多個提交按鈕點擊問題?)
                    <tbody id='2mCCV'></tbody>
                  <legend id='2mCCV'><style id='2mCCV'><dir id='2mCCV'><q id='2mCCV'></q></dir></style></legend>

                      <bdo id='2mCCV'></bdo><ul id='2mCCV'></ul>

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

                        1. <tfoot id='2mCCV'></tfoot>
                          1. <small id='2mCCV'></small><noframes id='2mCCV'>

                            主站蜘蛛池模板: 视频在线一区二区 | 操久久 | 福利视频一区 | 91九色婷婷| www.精品国产 | 成人精品免费视频 | 国产精品高潮呻吟久久 | 影音av | 视频一区二区中文字幕 | 久久精品国产一区 | 先锋资源吧| 国产精品日韩欧美一区二区 | 在线欧美小视频 | 成人日韩精品 | 久久久精品黄色 | 亚洲欧美在线一区 | 男女羞羞视频网站 | 亚洲视频免费一区 | 韩国久久 | 色av一区二区三区 | 国产精品日韩欧美一区二区三区 | 欧美日韩精品一区二区三区视频 | 作爱视频免费观看 | 日韩午夜在线观看 | 日韩电影中文字幕 | 久一精品| 欧美高清一级片 | 久草在线青青草 | 男女在线网站 | 欧美激情视频一区二区三区在线播放 | 中文字幕日本一区二区 | 美国黄色一级片 | 久久激情网 | 精品国产一区二区在线 | 污污的网站在线观看 | 成人免费片| 综合精品久久久 | 中文久久 | 精品一区二区三区在线视频 | 成人一区二区三区视频 | 天堂一区二区三区 |