【问题标题】:Azure B2C AD: Is the email address mandatory for Local Accounts identity providers based on Username?Azure B2C AD:基于用户名的本地帐户身份提供商的电子邮件地址是强制性的吗?
【发布时间】:2018-08-10 14:51:26
【问题描述】:

我错过了什么吗?似乎无法进行设置,以便在注册期间不需要(甚至根本不提示)电子邮件地址?您只能禁用电子邮件验证。

我们可能根本不允许用户输入电子邮件地址。他们必须仅使用用户名进行注册。一定要支持吗?

按照我能找到的关于该主题的所有文档,我已经从头开始重做了两次整个过程。但结果还是一样。我首先创建一个新的 B2C 租户,并确保在身份提供者下,仅选择“用户名”作为“本地帐户”。然后我转到“注册或登录策略”并创建一个自定义模板,然后单击编辑。然后我确保身份提供者设置为仅“用户 ID 注册”(和本地帐户),并且在注册属性以及应用程序声明中我没有选择“电子邮件地址”。然后我转到“页面 UI 自定义”并单击“本地帐户注册页面”。我输入我的自定义 URL。在“注册属性”下,它列出了“电子邮件地址”。电子邮件地址根本不应该在那里。当我单击电子邮件地址时,只有一个选项可以将“需要验证”设置为否。可选切换开关已禁用。所以我什至不能让它成为可选的。

这里的要点是,当我使用“用户名”而不是“电子邮件”作为身份提供者时,绝对不应该强制我使用电子邮件地址。

如果您在今天 2018 年 8 月 8 日的 Azure 门户中尝试上述步骤,我相信您会发现同样的限制。这对我来说似乎是一个错误,也许它在某个地方滑落了?

【问题讨论】:

标签: azure-ad-b2c


【解决方案1】:

是的,可以使用自定义策略在没有电子邮件的情况下在 B2C 中注册用户。 您可以按照提及here 的步骤创建自定义策略并下载starter kit,其中包含如何修改策略以满足您的要求的示例。

以下是我在注册用户时使用的技术资料,没有电子邮件是强制性的

 <TechnicalProfile Id="LocalAccountSignUpWithLogonName">
      <DisplayName>User ID signup</DisplayName>
      <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
      <Metadata>
        <Item Key="IpAddressClaimReferenceId">IpAddress</Item>
        <Item Key="ContentDefinitionReferenceId">api.localaccountsignup</Item>
        <Item Key="LocalAccountType">Username</Item>
        <Item Key="LocalAccountProfile">true</Item>
        <Item Key="language.button_continue">Create</Item>
      </Metadata>
      <CryptographicKeys>
        <Key Id="issuer_secret" StorageReferenceId="B2C_1A_TokenSigningKeyContainer" />
      </CryptographicKeys>
      <InputClaims>
        <InputClaim ClaimTypeReferenceId="signInName" />
      </InputClaims>
      <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="objectId" Required="true" />
        <OutputClaim ClaimTypeReferenceId="signInName" Required="true" />
        <OutputClaim ClaimTypeReferenceId="email" />
        <OutputClaim ClaimTypeReferenceId="newPassword" Required="true" />
        <OutputClaim ClaimTypeReferenceId="reenterPassword" Required="true" />
        <OutputClaim ClaimTypeReferenceId="jobTitle" />
        <OutputClaim ClaimTypeReferenceId="postalCode" />
        <OutputClaim ClaimTypeReferenceId="city" />
        <OutputClaim ClaimTypeReferenceId="givenName" />
        <OutputClaim ClaimTypeReferenceId="surName" />
        <OutputClaim ClaimTypeReferenceId="executed-SelfAsserted-Input" DefaultValue="true" />
        <OutputClaim ClaimTypeReferenceId="newUser" />
        <OutputClaim ClaimTypeReferenceId="authenticationSource" />
        <OutputClaim ClaimTypeReferenceId="userPrincipalName" />
      </OutputClaims>
      <ValidationTechnicalProfiles>
        <ValidationTechnicalProfile ReferenceId="AAD-UserWriteUsingLogonName" />
      </ValidationTechnicalProfiles>
      <UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />
    </TechnicalProfile>

【讨论】:

  • 对于重置密码,您可以在注册期间收集电话号码,在密码重置策略中,您可以使用 LocalAccountDiscoveryUsingLogonName 技术配置文件下的&lt;OutputClaim ClaimTypeReferenceId="OfficePhone" PartnerClaimType="Verified.OfficePhone" /&gt;,然后将其与 AAD-UserReadUsingLogonName 技术配置文件中的&lt;InputClaim ClaimTypeReferenceId="OfficePhone" PartnerClaimType="TelephoneNumber " Required="true" /&gt; 进行比较。欲了解更多信息,请参阅page
【解决方案2】:

允许您在基于用户名或基于电子邮件的帐户之间进行选择的切换开关用于指示其中哪些将用于登录。但是,这并不意味着在基于用户名的帐户中,电子邮件不会被收集 - 只是电子邮件不能用于登录。

无论如何,即使对于基于用户名的帐户,也需要基本策略中的电子邮件地址来支持密码重置用户旅程。如果 B2C 不收集电子邮件地址,则用户即使忘记密码也无法重置密码。

如果您真的不想收集电子邮件,那么您今天唯一的选择就是使用custom policies。在这种情况下,您必须确定如何支持密码重置(如果有的话)。

【讨论】:

  • 用手机号码代替邮箱地址重设密码怎么样?
  • 今天不支持手机号码。不过将来可能会添加它。
猜你喜欢
  • 2019-12-21
  • 2021-08-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多