azure - 仅验证从 Azure B2C AD 生成的 JWT token 的签名

标签 azure jwt azure-active-directory

我只想验证使用 Azure B2C AD 登录后收到的 token 的签名.

网络中显示的示例,使用 secret 或关键参数,我不确定从哪里可以获取它们,如果 Azure B2C AD生成 token 。

如果可能的话,我怎样才能只实现签名验证而不需要对 Audience 进行更多验证等等?

编辑它使用 "alg": "RS256"

最佳答案

微软有an example application它使用 AAD IdentityModel Extensions for .Net 中的 System.IdentityModel.Tokens.Jwt 来验证 JWT token (包括签名)。 Here is the code that does the actual validation ,它利用了 JwtSecurityTokenHandler。我想如果您只想删除签名验证代码,您可以从 the ValidateToken or ValidateSignature methods in the source code 中提取它。 .

关于azure - 仅验证从 Azure B2C AD 生成的 JWT token 的签名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51379146/

相关文章:

c# - 如何通过 POST 将参数传递给 Azure 函数?

azure - 作业终止后,如何将生成的文件从 Azure Databricks 导出到 Azure DevOps?

azure - Azure AD Multi-Tenancy SaaS 应用程序的租户特定主页 URL

c# - OpenIdConnectAuthenticationHandler : message. 状态为 null 或为空。连接到 Azure Active Directory 时

c# - 是否有可能使用 Graph Api 库方法或使用 C# 中的 HTTP 请求将多个用户添加到多个组?

azure - 通过 ARM 模板部署在 Azure Front Door 自定义域上启用 HTTPS

Azure 服务主体从容器注册表中提取镜像

azure - 如何在 Azure API 管理策略表达式中使用 RSA SHA256 签署 JWT?

authentication - NestJs 使用 jwt 和私钥和公钥进行身份验证

java - 如何获取jhipster jwt私钥?