2017-09-06 45 views

回答

1

Azure AD B2C中没有内置机制来限制注册到特定用户/电子邮件地址。您可以通过Azure AD B2C feedback forum申请。

但是,你可以自己实现:

  1. 有一个自定义属性,以确定用户是否是“认可”或不。您可以让用户自行注册,并且您可以创建经验或流程来查询Azure AD Graph,以获取尚未获得“批准”的用户,然后批准或删除它们。
  2. 建立邀请流程。当您邀请用户时,您需要通过Azure AD图创建用户。然后,您将引导您的用户使用密码重置策略作为其“帐户验证”流程。 这仅适用于本地帐户,因为您无法预先创建由社交帐户支持的用户。

这类似于Azure AD B2C - approval upon sign up?

1

这已经回答了,但一对夫妇的其他选项,

在一个自定义策略

您可以创建一个OIDC连接到另一个Azure的租户,然后不有一个注册链接,但只是登录

或者你可以有一个自定义注册策略,检查用户的电子邮件地址对预先定义的列表,你可以保存在存储,然后结束e旅程,如果你不想让他们继续

1

@saca提到的邀请流程的工作示例是here

WingTipToysWebApplication项目中,UserController控制器类有两种操作方法,MigrateActivate

Migrate方法使用随机密码创建本地帐户。

Activate方法执行以下步骤:

  • 它集称为本地帐户的ActivationStatus自定义属性设置为“待定”。
  • 它向本地帐户的电子邮件地址发送签名的兑换链接。此兑换链接包含此电子邮件地址和一个现时值。此随机数值确保兑换链接只能使用一次。
  • 它将电子邮件地址和随机数值保存在数据库记录中。

兑换链路由在WingTipGamesWebApplication项目的ActivationController控制器类的Redeem动作方法处理。

该控制器动作然后传递的电子邮件地址和随机数的值,作为“verified_email”和“随机数”的权利要求,从兑换链接到激活政策是here

激活政策声明这些权利要求输入声明:

<TrustFrameworkPolicy> 
    <RelyingParty> 
    <DefaultUserJourney ReferenceId="Activation" /> 
    <TechnicalProfile Id="Activation"> 
     <InputClaims> 
     <InputClaim ClaimTypeReferenceId="extension_Nonce" /> 
     <InputClaim ClaimTypeReferenceId="extension_VerifiedEmail" /> 
     </InputClaims> 
    </TechnicalProfile> 
    </RelyingParty> 
</TrustFrameworkPolicy> 

激活用户旅程的第一个编制步骤执行LocalAccount的激活技术简介:

<TechnicalProfile Id="LocalAccount-Activation"> 
    <DisplayName>WingTip Account</DisplayName> 
    <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /> 
    <Metadata> 
    <Item Key="ContentDefinitionReferenceId">api.localaccount.activation</Item> 
    <Item Key="IpAddressClaimReferenceId">IpAddress</Item> 
    </Metadata> 
    <CryptographicKeys> 
    <Key Id="issuer_secret" StorageReferenceId="TokenSigningKeyContainer" /> 
    </CryptographicKeys> 
    <IncludeInSso>false</IncludeInSso> 
    <InputClaimsTransformations> 
    <InputClaimsTransformation ReferenceId="CreateEmailFromVerifiedEmail" /> 
    </InputClaimsTransformations> 
    <InputClaims> 
    <InputClaim ClaimTypeReferenceId="extension_VerifiedEmail" /> 
    </InputClaims> 
    <OutputClaims> 
    <OutputClaim ClaimTypeReferenceId="extension_VerifiedEmail" Required="true" /> 
    <OutputClaim ClaimTypeReferenceId="authenticationSource" /> 
    <OutputClaim ClaimTypeReferenceId="objectId" /> 
    <OutputClaim ClaimTypeReferenceId="strongAuthenticationPhoneNumber" /> 
    <OutputClaim ClaimTypeReferenceId="sub" /> 
    <OutputClaim ClaimTypeReferenceId="userPrincipalName" /> 
    </OutputClaims> 
    <ValidationTechnicalProfiles> 
    <ValidationTechnicalProfile ReferenceId="ClassicAccount-CheckNonce" /> 
    <ValidationTechnicalProfile ReferenceId="AzureActiveDirectoryStore-ReadUserByEmail-ThrowIfNotExists" /> 
    </ValidationTechnicalProfiles> 
</TechnicalProfile> 

此技术档案通过调用API验证电子邮件地址和随机数值后端(见WingTipIdentityWebApplication项目AccountController控制器类的CheckNonce操作方法),这是由ClassicAccount-CheckNonce技术简介表示:

<TechnicalProfile Id="ClassicAccount-CheckNonce"> 
    <DisplayName>Classic Account Check Nonce</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://wingtipidentityb2c.azurewebsites.net/api/account/checknonce</Item> 
    <Item Key="AuthenticationType">Basic</Item> 
    <Item Key="HttpBinding">POST</Item> 
    <Item Key="SendClaimsIn">Form</Item> 
    </Metadata> 
    <CryptographicKeys> 
    <Key Id="BasicAuthenticationUsername" StorageReferenceId="ClassicAccountClientId" /> 
    <Key Id="BasicAuthenticationPassword" StorageReferenceId="ClassicAccountClientSecret" /> 
    </CryptographicKeys> 
    <InputClaims> 
    <InputClaim ClaimTypeReferenceId="extension_verifiedEmail" PartnerClaimType="userName" /> 
    <InputClaim ClaimTypeReferenceId="extension_Nonce" PartnerClaimType="nonce" /> 
    </InputClaims> 
    <UseTechnicalProfileForSessionManagement ReferenceId="SSOSession-Noop" /> 
</TechnicalProfile> 

此API后端验证的电子邮件地址,并在现时值数据库记录。如果电子邮件地址确实存在,并且该电子邮件地址的随机数值有效(即尚未使用),则API后端返回200 OK,新用户可以继续执行激活的第二个编排步骤用户旅程(即重置本地帐户的随机密码)。如果不是,那么它返回409冲突并显示一条错误消息,由B2C向最终用户显示。