我有一个自定义策略,带有OpenID Connect技术配置文件呼叫授权和令牌端点,从元数据项目到我的自定义API中间件,该终点用于将其重定向到Apple Authenticathion端点/网站,因此我可以在我的自定义策略中处理一个多PPPLE解决方案,试图忽略<<< strong> client_id 和 idtokenaudience 。
Microsoft文档指出:
但不幸的是,文档是错误的,并且在成功获得苹果令牌并通过在苹果控制台上为该客户端配置的redirect_uri返回B2C 后,始终将其验证为b2c 我能够通过API中的授权端点。
一些B2C专家能否忽略自定义策略中的OpenID Connect TP中的IdTokenaudience?
Microsoft参考文档:
预先感谢!
I have a custom policy with an OpenId Connect Technical Profile calling authorize and token endpoints from metadata Items to my custom API middleware which is used to redirect to Apple authenticathion endpoint/website so i can handle a multiApple solution within my custom Policy trying to Ignore client_id and IdTokenAudience.
Microsoft documentation states:

But unfortunatelly the documentation is wrong and the TokenAudience is always validated after get sucessfully the Apple token and return the flow to B2C through the redirect_uri configured in Apple console for that clientId that I am able to pass through the Authorize endpoint in my API.
Can some B2C expert shed some light about ignore the IdTokenAudience in an OpenId Connect TP inside a Custom Policy?
Microsoft Reference document:
https://learn.microsoft.com/en-us/azure/active-directory-b2c/openid-connect-technical-profile
Thanks in advance!
发布评论
评论(2)
好的,我会回答我的问题。
如@JAS所述,由于安全验证,您无法摆脱客户端。因此,如果有人试图实施这种情况,我将解释我的方法:
使用client_id =“ myaudience”创建这样的技术配置文件,并使用元数据项目指向您的自定义OIDC Microservice Metadata。必须将B2C App客户端ID(B2C URL客户ID)传递,作为输入索赔以处理不同的Apple Client_id的索赔,具体取决于注册应用程序:
您的自定义Multi-IDP Microservice将通过querysize端口捕获corypoint,并应从querysize端口中捕获clientId并从存储与之相对应的Apple client_id,teamID,redirect_uri(比Apple Console相同),KeyID和发行器。
您 /授权应重定向到Apple身份验证页面,并提示您的凭据。< /p>
输入凭据后,请单击“继续”按钮您 /令牌端点,此时,您需要从密钥库中检索.p8 Secret(private键)以生成与代码一起使用的令牌在 /令牌体内。
client_id,client_secret和keyID应用自定义存储的数据覆盖。
有关更多信息,请参阅此文档: https://learn.microsoft.com/en-us/azure/active-directory-b2c/openid-connect-technical-profile
该秘密在上面的技术配置文件中被称为CryptographyKey,为:b2c_1a_multiidp
。
愉快的编码!
2023年6月更新:
令牌生成器类:
Apple服务:
Ok, i will answer my question.
As stated by @Jas you cannot get rid of client_id because of security validations. So if someone is trying to implement such scenario, i will explain my approach:
Create a Technical Profile like this with client_id="myaudience" and use METADATA item to point to your custom OIDC microservice metadata. A B2C app clientId (B2C URL clientId) must be passed as input claim to handle diferent Apple client_id's depending on registered App:
Your custom multi-IDP microservice will capture in the /authorize endpoint via queryString the clientId and should retrieve from a storage the Apple client_id, teamId, redirect_uri (same than Apple console), KeyId and Issuer corresponding to it.
your /authorize should redirect to the Apple authentication page and will prompt for your credentials.
After enter credentials and click on "continue" button your /token endpoint should be fired, at this point you need to retrieve the .p8 secret (Private Key) from a Key Vault to generate the token to be used with the code in the /token body.
The client_id, client_secret and keyId should be overrided with your custom stored data.
Refer to this doc for more info: https://learn.microsoft.com/en-us/azure/active-directory-b2c/openid-connect-technical-profile
This secret is referenced as cryptographickey in the Technical Profile above as: B2C_1A_MultiIDP
Thats all! Happy coding!
Update Jun 2023:
Token Generator class:
Apple Service:
它被用作替代。
当不存在此元数据项目时,我们确保观众与预期的受众client_id匹配。
指定后,我们确保AUD索赔与您在元数据项目中所述的内容匹配。
这永远不允许关闭验证。
It’s being used as an override.
When this metadata item is not present, we make sure the audience matches the expected audience, client_id.
When it is specified, we make sure the aud claim matches what you state in the metadata item.
This never allows the verification to be turned off.