2017-09-06 46 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向最終用戶顯示。