仅验证从Azure B2C AD生成的JWT令牌的签名

时间:2018-07-17 10:30:02

标签: azure jwt azure-active-directory

我只想验证使用Azure B2C AD登录后收到的令牌的签名。

网络上显示的示例使用秘密或密钥参数,如果Azure B2C AD生成令牌,我不确定从哪里可以得到它们。

如果有可能,我如何仅实现该签名验证,而无需对Audience等进行更多验证?

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

1 个答案:

答案 0 :(得分:2)

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

相关问题