我只想验证使用 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/