【问题标题】:Use existing identity provider in custom B2C policy在自定义 B2C 策略中使用现有身份提供者
【发布时间】:2020-07-29 00:01:59
【问题描述】:

我们一直在使用我们在身份提供者页面上创建的 OpenID 身份提供者。此身份提供程序连接到我们的 Azure AD。

我们现在需要切换到自定义策略,以便我们可以在从 azure 函数检索到的令牌中包含一些附加信息。

问题在于,即使我们在自定义策略中使用了相同的 openID 连接信息,它仍被视为新的身份提供者,并且任何登录的用户都会创建一个新用户,因此会创建一个新的 OID。

我们需要他们使用相同的身份提供者登录并使用相同的现有用户/oid,但要通过我们的自定义策略,以便我们可以将信息添加到令牌中。

【问题讨论】:

    标签: azure azure-ad-b2c


    【解决方案1】:

    我假设您正在添加 Azure AD(单租户)IDP。因此,您要添加的元数据是 https://login.microsoftonline.com/{tenant}/v2.0/.well-known/openid-configuration 。将 {tenant} 替换为您的租户值。此外,请确保在自定义策略中您具有 UserID 和 identityprovider 的以下配置,因为在 AzureAD IDP 流中,它会根据 AlternativeSecurityID 检查它是否存在于 B2C 租户中,如果没有,则它会创建一个新 ID,否则它将传递 ObjectID。

    <OutputClaims>
    <OutputClaim ClaimTypeReferenceId="issuerUserId" PartnerClaimType="oid"/>
    <OutputClaim ClaimTypeReferenceId="identityProvider" PartnerClaimType="iss" />
    </OutputClaims>
    <OutputClaimsTransformations>
    <OutputClaimsTransformation ReferenceId="CreateAlternativeSecurityId"/>
    </OutputClaimsTransformations>
    

    在 Azure AD 身份验证 B2C 调用此技术配置文件以读取 B2C 租户中的用户详细信息后:

    <TechnicalProfile Id="AAD-UserReadUsingAlternativeSecurityId">
    <Metadata>
    <Item Key="Operation">Read</Item>
    <Item Key="RaiseErrorIfClaimsPrincipalDoesNotExist">false</Item>
    </Metadata>
    <InputClaims>
    <InputClaim ClaimTypeReferenceId="AlternativeSecurityId" 
    PartnerClaimType="alternativeSecurityId" Required="true" />
    </InputClaims>
    <OutputClaims>
    <OutputClaim ClaimTypeReferenceId="objectId" />
    <OutputClaim ClaimTypeReferenceId="userPrincipalName" />
    <OutputClaim ClaimTypeReferenceId="displayName" />
    <OutputClaim ClaimTypeReferenceId="otherMails" />
    <OutputClaim ClaimTypeReferenceId="givenName" />
    <OutputClaim ClaimTypeReferenceId="surname" />
    </OutputClaims>
    <IncludeTechnicalProfile ReferenceId="AAD-Common" />
    </TechnicalProfile>
    

    【讨论】:

    • 我遇到了同样的问题,我在我的自定义策略中进行了此设置,但仍然创建了一个新帐户,因为我的自定义策略中的身份提供者与我的身份提供者不同之前在 GUI 中创建。
    猜你喜欢
    • 2022-11-05
    • 1970-01-01
    • 2019-11-28
    • 1970-01-01
    • 2021-03-23
    • 2022-11-04
    • 2022-11-30
    • 2020-03-15
    • 1970-01-01
    相关资源
    最近更新 更多