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

    1. <tfoot id='Mw60M'></tfoot>
      <legend id='Mw60M'><style id='Mw60M'><dir id='Mw60M'><q id='Mw60M'></q></dir></style></legend>
      1. <small id='Mw60M'></small><noframes id='Mw60M'>

        DNX Core 5.0 JwtSecurityTokenHandler“IDX10640:不支持算法

        时间:2023-06-01
          <bdo id='W2D9J'></bdo><ul id='W2D9J'></ul>

            <tfoot id='W2D9J'></tfoot>

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

              <tbody id='W2D9J'></tbody>

            <i id='W2D9J'><tr id='W2D9J'><dt id='W2D9J'><q id='W2D9J'><span id='W2D9J'><b id='W2D9J'><form id='W2D9J'><ins id='W2D9J'></ins><ul id='W2D9J'></ul><sub id='W2D9J'></sub></form><legend id='W2D9J'></legend><bdo id='W2D9J'><pre id='W2D9J'><center id='W2D9J'></center></pre></bdo></b><th id='W2D9J'></th></span></q></dt></tr></i><div id='W2D9J'><tfoot id='W2D9J'></tfoot><dl id='W2D9J'><fieldset id='W2D9J'></fieldset></dl></div>
              <legend id='W2D9J'><style id='W2D9J'><dir id='W2D9J'><q id='W2D9J'></q></dir></style></legend>
                  本文介绍了DNX Core 5.0 JwtSecurityTokenHandler“IDX10640:不支持算法:'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256'"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在尝试实现 JWT 令牌,但一直遇到以下异常:IDX10640:不支持算法:'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256' 尝试将令牌写入压缩 json 字符串时.

                  I'm trying to implement JWT tokens but keep running into the following exception: IDX10640: Algorithm is not supported: 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256' when trying to write the token to compact json string.

                  const string issuer = "issuer";
                  const string audience = "audience";
                  byte[] keyForHmacSha256 = new byte[32];
                  new Random().NextBytes(keyForHmacSha256);
                  
                  var claims = new List<Claim> { new Claim("deviceId", "12") };
                  var now = DateTime.UtcNow;
                  var expires = now.AddHours(1);
                  var signingCredentials = new SigningCredentials(
                      new SymmetricSecurityKey(keyForHmacSha256), 
                      SecurityAlgorithms.HmacSha256Signature, SecurityAlgorithms.Sha256Digest);
                  
                  var token = new JwtSecurityToken(issuer, audience, claims, now, expires, signingCredentials);
                  return _tokenHandler.WriteToken(token);
                  

                  有解决这个问题的想法吗?

                  Any ideas on solving this?

                  更新 1:

                  上述错误发生在 "System.IdentityModel.Tokens.Jwt": "5.0.0-beta7-208241120"

                  The error above occurs with "System.IdentityModel.Tokens.Jwt": "5.0.0-beta7-208241120"

                  更新 2:

                  更新代码

                  推荐答案

                  我们目前不支持对称密钥.希望能尽快实现.

                  We don't have support for symmetric keys right now. Hope to get that in soon.

                  这篇关于DNX Core 5.0 JwtSecurityTokenHandler“IDX10640:不支持算法:'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256'"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:无法验证 UseJwtBearerAuthentication 中的令牌.授权被拒 下一篇:通过 IdentityServer 身份验证后如何获取 WebAPI 控制

                  相关文章

                  最新文章

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

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

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

                      <bdo id='DZyln'></bdo><ul id='DZyln'></ul>