Azure AD B2C 打破了 OIDC 规范

问题描述 投票:0回答:2

我已为每个this链接使用AAD B2C IEF配置了自定义策略,现在正在尝试将其作为每个this链接的JWT授权者集成到API网关中。

但是,尝试配置授权者会引发错误

更新 API Gateway v2 授权者时出错
错误请求异常
连接到颁发者 https://tenant-domain.b2clogin.com/tenant-id-here/v2.0/.well-known/openid-configuration 时捕获异常 https://tenant-domain.b2clogin。 com/tenant-id-here/v2.0/.
请稍后重试。
错误:
无效发行人:
https://tenant-domain.b2clogin.com/tenant-id-here/v2.0/.
发行者必须拥有以“/.well-known/openid-configuration”结尾的有效发现端点

实际的发现端点是

https://tenant-domain.b2clogin.com/tenant-domain.onmicrosoft.com/b2c_1a_signup_signin/v2.0/.well-known/openid-configuration,但是,它返回的文档为下面,它的发行者与发现 URL 不同。

{ "issuer": "https://tenant-domain.b2clogin.com/tenant-id-here/v2.0/", "authorization_endpoint": "https://tenant-domain.b2clogin.com/tenant-domain.onmicrosoft.com/b2c_1a_signup_signin/oauth2/v2.0/authorize", "token_endpoint": "https://tenant-domain.b2clogin.com/tenant-domain.onmicrosoft.com/b2c_1a_signup_signin/oauth2/v2.0/token", "end_session_endpoint": "https://tenant-domain.b2clogin.com/tenant-domain.onmicrosoft.com/b2c_1a_signup_signin/oauth2/v2.0/logout", "jwks_uri": "https://tenant-domain.b2clogin.com/tenant-domain.onmicrosoft.com/b2c_1a_signup_signin/discovery/v2.0/keys", "response_modes_supported": [ "query", "fragment", "form_post" ], "response_types_supported": [ "code", "code id_token", "code token", "code id_token token", "id_token", "id_token token", "token", "token id_token" ], "scopes_supported": [ "openid" ], "subject_types_supported": [ "pairwise" ], "id_token_signing_alg_values_supported": [ "RS256" ], "token_endpoint_auth_methods_supported": [ "client_secret_post", "client_secret_basic" ], "claims_supported": [ "name", "given_name", "family_name", "email", "sub", "tid", "iss", "iat", "exp", "aud", "acr", "nonce", "auth_time" ] }
查看 

this 问题和 spec,看起来 AAD 不符合规范。

有什么方法可以让它发挥作用,还是我必须转向符合规范的 OIDC 提供商?

azure azure-active-directory azure-ad-b2c openid-connect api-gateway
2个回答
2
投票
请尝试配置发行者 URL

包括 tfp 以实现令牌兼容性。

更多详情请参阅:

代币兼容性 上面写着:

注意:iss 声明,即;发行人确定 azure ad b2c 的租户 发行了令牌。通常该值是这样的 :https://<domain>/{B2C tenant GUID}/v2.0/


但是我

如果您的应用程序或库需要 Azure AD B2C 符合 OpenID Connect Discovery 1.0 规范,请使用此 https://<domain>/tfp/{B2C tenant GUID}/{Policy ID}/v2.0/

 因为它
包括 Azure AD B2C 租户和用户流的 ID
在令牌请求中使用。

例如:

“issuer” : “https://your-tenant-name.b2clogin.com/tfp/c5b2xxxxxxxxx0-8axxxxxx3d3b/B2C_1A_signin/v2.0/”

https://{tenantID}.b2clogin.com/tfp/{tenantID}/{policy-name}/v2.0/

参考资料:

  1. 手动配置 Azure Active Directory B2C 提供商 - Power 应用程序 |微软文档
  2. 使用 AWS API Gateway v2 JWT 授权者进行 AzureAD 身份验证 | rayterrill.com

0
投票
除了 @kavyasaraboju-MT 的答案之外,如果您使用自定义策略,则必须根据

这些文档

IssuanceClaimPattern
 技术配置文件中将 
AuthorityWithTfp
 设置为 
JwtIssuer

例如使用

active-directory-b2c-custom-policy-starterpack 中的 LocalAccounts 包,将元素 <Item Key="IssuanceClaimPattern">AuthorityWithTfp</Item>

 添加到 
<Metadata>
 
element

© www.soinside.com 2019 - 2024. All rights reserved.