我目前正在制定 Azure AD B2C 自定义策略,该策略使用户能够拥有多个身份(Google、Microsoft、Apple 和 Entra ID)。 Entra ID ClaimsProvider 设置从
entraTenantId
声明派生的 iss
声明,然后通过 RelyingParty 发送到应用程序。
但是,我注意到应用程序使用
grant_type: refresh_token
获取新令牌后,UserJourney RedeemRefreshToken
不会返回 entraTenantId
或 identityProvider
,这对于我的应用程序至关重要功能。
有人可以建议如何确保
entraTenantId
和 identityProvider
包含在刷新的令牌中,或者建议解决此问题的替代方法吗?
我尝试通过将
entraTenantId
输出声明添加到 RefreshTokenReadAndSetup
ClaimsProvider 来解决该问题,但不幸的是,这种调整没有产生预期的结果。
我的目标是检索并输出用户最初用于从
RedeemRefreshToken
旅程登录的提供商的名称。
我追求的解决方案基于Azure AD B2C提供的SocialAndLocalAccounts示例。
谢谢!
如果其他人也遇到同样的问题,我最终通过将声明添加到
RefreshTokenReadAndSetup
TechnicalProfile 来解决问题。文档中没有明确提及,但 AAD B2C 在颁发新令牌时能够使用原始身份验证上下文。
<ClaimsProvider>
<DisplayName>Refresh token journey</DisplayName>
<TechnicalProfiles>
<TechnicalProfile Id="RefreshTokenReadAndSetup">
<DisplayName>Trustframework Policy Engine Refresh Token Setup Technical Profile</DisplayName>
<Protocol Name="None" />
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="objectId" />
<OutputClaim ClaimTypeReferenceId="refreshTokenIssuedOnDateTime" />
<OutputClaim ClaimTypeReferenceId="entraTenantId" PartnerClaimType="entra_id_tenant" />
<OutputClaim ClaimTypeReferenceId="identityProvider" />
</OutputClaims>
</TechnicalProfile>