【问题标题】:Identity Experience Framework and social accounts身份体验框架和社交账户
【发布时间】:2021-06-15 07:54:27
【问题描述】:

我制定了一项策略,允许使用用户名和密码(B2C 用户)或使用 Microsoft 帐户登录,将 AD 连接为 OpenId 身份提供程序。它工作正常,但是当我使用我的 Microsoft 帐户登录时,未设置电子邮件:

我想我必须在下面的 sn-p 中设置一些东西:

<TechnicalProfile Id="AAD-UserWriteUsingAlternativeSecurityId">
    <Metadata>
        <Item Key="Operation">Write</Item>
        <Item Key="RaiseErrorIfClaimsPrincipalAlreadyExists">true</Item>
        <Item Key="UserMessageIfClaimsPrincipalAlreadyExists">You are already registered, please press the back button and sign in instead.</Item>
    </Metadata>
    <IncludeInSso>false</IncludeInSso>
    <InputClaimsTransformations>
        <InputClaimsTransformation ReferenceId="CreateOtherMailsFromEmail" />
    </InputClaimsTransformations>
    <InputClaims>
        <InputClaim ClaimTypeReferenceId="AlternativeSecurityId" PartnerClaimType="alternativeSecurityId" Required="true" />
    </InputClaims>
    <PersistedClaims>
        <!-- Required claims -->
        <PersistedClaim ClaimTypeReferenceId="alternativeSecurityId" />
        <PersistedClaim ClaimTypeReferenceId="userPrincipalName" />
        <PersistedClaim ClaimTypeReferenceId="mailNickName" DefaultValue="unknown" />
        <PersistedClaim ClaimTypeReferenceId="displayName" DefaultValue="unknown" />

        <!-- Optional claims -->
        <PersistedClaim ClaimTypeReferenceId="otherMails" />
        <PersistedClaim ClaimTypeReferenceId="givenName" />
        <PersistedClaim ClaimTypeReferenceId="surname" />
    </PersistedClaims>
    <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="objectId" />
        <OutputClaim ClaimTypeReferenceId="newUser" PartnerClaimType="newClaimsPrincipalCreated" />
        <OutputClaim ClaimTypeReferenceId="otherMails" />
    </OutputClaims>
    <IncludeTechnicalProfile ReferenceId="AAD-Common" />
    <UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />
</TechnicalProfile>

我尝试将&lt;PersistedClaim ClaimTypeReferenceId="email"/&gt; 添加到PersistedClaims,但收到错误请求并显示消息:指定的一个或多个属性值无效。

this 页面上,我看到正确的定义是mail。我还尝试定义一个新的ClaimType 并使用ClaimsTransformationotherMails 获取值,但该字段未设置。

【问题讨论】:

    标签: azure-ad-b2c azure-ad-b2c-custom-policy


    【解决方案1】:

    这不起作用:

    <PersistedClaim ClaimTypeReferenceId="email"/>
    

    因为在名为“email”的用户对象上没有这样的属性。

    你可以这样做:

    <PersistedClaim ClaimTypeReferenceId="email" PartnerClaimType="signInNames.emailAddress"/>
    

    这将显示在 Azure 门户中的 userPrincipalName 下。这也意味着用户无法使用该电子邮件注册本地帐户,实际上您创建了一个“双重/链接帐户”,尽管没有密码。 然后,用户需要重置此帐户的密码才能使用用户名和密码访问它,例如,如果他们在 Facebook 上删除了他们的社交帐户。

    另一种选择是写信给otherMails

    <PersistedClaim ClaimTypeReferenceId="email" PartnerClaimType="otherMails"/>
    

    这可能需要是一个数组,所以在编写它之前先使用一个 claimTransform 来构建一个数组。

    不要将电子邮件写入mail 属性,B2C 帐户支持的属性是here

    【讨论】:

      猜你喜欢
      • 2023-04-07
      • 2020-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-09
      • 2015-10-31
      • 1970-01-01
      相关资源
      最近更新 更多