如何在注册Azure B2C时将电子邮件域列入白名单



我使用的是Azure B2C的简单电子邮件注册,而不是SSO,我的用户流是本教程中的基本用户流

https://learn.microsoft.com/en-ca/azure/active-directory-b2c/tutorial-create-user-flows

然而,目前我正在使用临时电子邮件地址进行测试,当我上线时,我想将人们可以注册的域列入白名单。

我该如何做这个白名单?

当前使用Azure AD B2C用户流,我们无法在基于电子邮件域注册时将用户列入白名单。我们需要通过调用Rest API使用自定义策略进行处理,并需要验证电子邮件地址。

请浏览有关使用Rest API自定义策略的文档和示例。

Restful技术概要文件提供了与您自己的Restful服务接口的支持。Azure AD B2C将数据发送到InputClaims集合中的RESTful服务,并在OutputClaims集合中接收回数据。在中查找ClaimsProviders元素

配置REST API技术配置文件

<ClaimsProvider>
<DisplayName>REST APIs</DisplayName>
<TechnicalProfiles>
<TechnicalProfile Id="REST-GetProfile">
<DisplayName>Get user extended profile Azure Function web hook</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
<Item Key="ServiceUrl">https://your-account.azurewebsites.net/api/GetProfile?code=your-code</Item>
<Item Key="SendClaimsIn">Body</Item>
<!-- Set AuthenticationType to Basic or ClientCertificate in production environments -->
<Item Key="AuthenticationType">None</Item>
<!-- REMOVE the following line in production environments -->
<Item Key="AllowInsecureAuthInProduction">true</Item>
</Metadata>
<InputClaims>
<!-- Claims sent to your REST API -->
<InputClaim ClaimTypeReferenceId="objectId" />
<InputClaim ClaimTypeReferenceId="userLanguage" PartnerClaimType="lang" DefaultValue="{Culture:LCID}" AlwaysUseDefaultValue="true" />
</InputClaims>
<OutputClaims>
<!-- Claims parsed from your REST API -->
<OutputClaim ClaimTypeReferenceId="balance" />
</OutputClaims>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop" />
</TechnicalProfile>
</TechnicalProfiles>
</ClaimsProvider>

您需要在REST API中处理电子邮件验证逻辑。以上提供的文档链接可帮助您建立自定义策略。

Azure Feedback用户语音中已经提出了此限制,为了将来考虑此功能请求,请对现有用户语音进行投票。这样,产品组就可以相应地对此进行优先级排序。

您可以在此处参考此策略https://github.com/azure-ad-b2c/samples/tree/master/policies/sign-up-domain-allowlistregex以允许列出

<Pattern RegularExpression="^[a-zA-Z0-9.!#$%&amp;'^_`{}~-]+@(outlook[.]com|live[.]com|gmail[.]com)" HelpText="Please enter a email address from one of the following domains: outlook.com, live.com." />

最新更新