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

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

      <tfoot id='xXwQZ'></tfoot>

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

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

      System.IdentityModel.Tokens.JwtSecurityToken 自定義屬性

      System.IdentityModel.Tokens.JwtSecurityToken custom properties(System.IdentityModel.Tokens.JwtSecurityToken 自定義屬性)

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

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

            <tfoot id='S9ss9'></tfoot>
                <tbody id='S9ss9'></tbody>
                <bdo id='S9ss9'></bdo><ul id='S9ss9'></ul>
                <legend id='S9ss9'><style id='S9ss9'><dir id='S9ss9'><q id='S9ss9'></q></dir></style></legend>
                本文介紹了System.IdentityModel.Tokens.JwtSecurityToken 自定義屬性的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我的 AuthServer 目前正在使用以下代碼生成 JwtSecurityToken:

                My AuthServer is currently using the following code to generate a JwtSecurityToken:

                var token = new JwtSecurityToken(_issuer, audienceId, data.Identity.Claims, issued.Value.UtcDateTime, expires.Value.UtcDateTime, signingKey);
                var handler = new JwtSecurityTokenHandler();
                var jwt = handler.WriteToken(token);
                

                有效載荷如下所示:

                {
                  "unique_name": "myUserName",
                  "sub": "myUserName",
                  "role": "API_User",
                  "iss": "Automation",
                  "aud": "099153c2625149bc8ecb3e85e03f0022",
                  "exp": 1486056731,
                  "nbf": 1483464731
                }
                

                我想在令牌負載中添加一些自定義字段/屬性,例如 ProfilePicURL,以便負載看起來像這樣:

                I would like to add some custom fields/properties within the token payload, such as ProfilePicURL, so that the payload can look something like this:

                {
                  "unique_name": "myUserName",
                  "sub": "myUserName",
                  "role": "API_User",
                  "iss": "Automation",
                  "aud": "099153c2625149bc8ecb3e85e03f0022",
                  "exp": 1486056731,
                  "nbf": 1483464731,
                  "profilePicture": "http://url/user.jpg"
                }
                

                如何添加這些自定義屬性并確保令牌包含它們?

                How do I go about adding these custom properties and ensuring that the token contains them?

                推薦答案

                JwtSecurityToken 暴露了一個 JwtPayload Payload { get;設置;} 屬性.JwtPayload 派生自 Dictionary 所以只需將其添加到有效負載中...

                JwtSecurityToken exposes a JwtPayload Payload { get; set;} property. JwtPayload derives from Dictionary<string, object> so just add it to the payload...

                var token = new JwtSecurityToken(_issuer, audienceId, data.Identity.Claims, issued.Value.UtcDateTime, expires.Value.UtcDateTime, signingKey);
                token.Payload["profilePicture"] = "http://url/user.jpg"
                var handler = new JwtSecurityTokenHandler();
                var jwt = handler.WriteToken(token);
                

                使用 WriteToken 對令牌進行編碼和簽名很重要,因為簡單地獲取 RawData 屬性將不起作用(令牌將不包含自定義聲明).

                It is important that you use WriteToken to encode and sign the token, as simply getting the RawData property will not work (the token will not contain the custom claims).

                這篇關于System.IdentityModel.Tokens.JwtSecurityToken 自定義屬性的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)
                  <tbody id='dQIIj'></tbody>
                  <bdo id='dQIIj'></bdo><ul id='dQIIj'></ul>

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

                      • <legend id='dQIIj'><style id='dQIIj'><dir id='dQIIj'><q id='dQIIj'></q></dir></style></legend>

                      • <i id='dQIIj'><tr id='dQIIj'><dt id='dQIIj'><q id='dQIIj'><span id='dQIIj'><b id='dQIIj'><form id='dQIIj'><ins id='dQIIj'></ins><ul id='dQIIj'></ul><sub id='dQIIj'></sub></form><legend id='dQIIj'></legend><bdo id='dQIIj'><pre id='dQIIj'><center id='dQIIj'></center></pre></bdo></b><th id='dQIIj'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='dQIIj'><tfoot id='dQIIj'></tfoot><dl id='dQIIj'><fieldset id='dQIIj'></fieldset></dl></div>
                        • <tfoot id='dQIIj'></tfoot>
                          主站蜘蛛池模板: 伊人狼人影院 | 久久久久久国模大尺度人体 | 亚洲一区二区三区在线 | 操久久 | 国产综合久久 | 高清久久久| 国产美女视频一区 | tube国产 | 国产成人av免费看 | 日韩欧美三区 | 国产成人福利在线观看 | 狠狠婷婷综合久久久久久妖精 | aaaa网站| 91视频免费视频 | 成人午夜影院 | 久久精品av麻豆的观看方式 | 亚洲国产一区在线 | 五月婷婷丁香 | 亚洲www| 国产精品日韩欧美一区二区三区 | 操人网 | 国产成人精品一区二区三区 | 99视频在线播放 | 久久久999成人 | 亚洲精品久 | 日韩欧美国产精品一区二区三区 | 视频在线一区 | 国产成人99久久亚洲综合精品 | 久久久99国产精品免费 | 正在播放亚洲 | 超碰免费在线观看 | 国产免费一区二区三区网站免费 | 国产精品久久久久久久久久了 | 久久久久久久综合 | 欧美一区二区三区 | 亚洲激情在线观看 | 国产特级毛片 | 国产高清免费在线 | 成人h电影在线观看 | 国产精品中文 | 日韩欧美成人一区二区三区 |