我的Azure AD B2C令牌的密钥在哪里? [英] Where's the Key for My Azure AD B2C Token?

查看:143
本文介绍了我的Azure AD B2C令牌的密钥在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是遵循本指南并使用 jwt.io chrome插件,但我不能找到我的密钥,以便我可以手动验证签名.

JWT标头

{
  "typ": "JWT",
  "alg": "RS256",
  "kid": "c9HOlAkfaBs4YSKZ7RoMnZlKrVzdkXHB2QoLv1fETQ8"
}

OpenID Connect元数据文档导致我转到 https://login.microsoftonline.com/common/discovery/v2. 0/键,但没有这个孩子.

我也引用了解决方案

用于检索Azure AD B2C租户密钥的URL具有以下格式:

https://login.microsoftonline.com/te/<tenantName>.onmicrosoft.com/b2c_1_<policyName>/discovery/v2.0/keys

例如:

https://login.microsoftonline .com/te/fabrikamb2c.onmicrosoft.com/b2c_1_edit_profile/discovery/v2.0/keys

请注意,键和URL与常规Azure AD和Azure AD的v2.0终结点(后者是您在问题中引用的URL)不同.

这时,所有内置策略(即使是跨租户)也使用相同的密钥,但是在 Azure AD B2C-令牌验证无效

I'm following this guide and using the jwt.io chrome addin but I can't find my key so that I can manually verify the signature.

JWT Header

{
  "typ": "JWT",
  "alg": "RS256",
  "kid": "c9HOlAkfaBs4YSKZ7RoMnZlKrVzdkXHB2QoLv1fETQ8"
}

The OpenID Connect metadata document leads me to https://login.microsoftonline.com/common/discovery/v2.0/keys but that response not have this kid.

I've also referenced this blog post.

解决方案

The URL to retrieve your Azure AD B2C tenant's keys has the following format:

https://login.microsoftonline.com/te/<tenantName>.onmicrosoft.com/b2c_1_<policyName>/discovery/v2.0/keys

For example:

https://login.microsoftonline.com/te/fabrikamb2c.onmicrosoft.com/b2c_1_edit_profile/discovery/v2.0/keys

Note that both the keys and URLs are different from those for regular Azure AD and Azure AD's v2.0 endpoint (the latter being the URL you referenced in your question).

At this time, the keys for all built-in policies (even across tenants) use the same keys, however in the case of custom policies you'll see different keys per tenant and even in some cases, per policy.

Important note: You won't be able to use jwt.io out of the box to validate Azure AD B2C tokens given that the keys in Azure AD B2C are in a different format. See Azure AD B2C - Token validation does not work

这篇关于我的Azure AD B2C令牌的密钥在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆