Пользовательская политика Azure B2C — отображение кнопки при проверке

#azure #azure-ad-b2c

#azure #azure-ad-b2c

Вопрос:

Похоже, что в Azure B2C Custom policy framework не так много справочных материалов и форумов.

Я использовал следующий технический профиль для своей пользовательской политики.

     <TechnicalProfile Id="AAD-UserReadUsingEmailAddress">
              <Metadata>
                <Item Key="Operation">Read</Item>
                <Item Key="RaiseErrorIfClaimsPrincipalDoesNotExist">true</Item>
                <Item Key="UserMessageIfClaimsPrincipalDoesNotExist">An account could not be found for the provided user ID.</Item>
              </Metadata>
              <IncludeInSso>false</IncludeInSso>
              <InputClaims>
                <InputClaim ClaimTypeReferenceId="email" PartnerClaimType="signInNames.emailAddress" Required="true" />
              </InputClaims>
              <OutputClaims>
                <!-- Required claims -->
                <OutputClaim ClaimTypeReferenceId="objectId" />
                <OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="localAccountAuthentication" />
     
                <OutputClaim ClaimTypeReferenceId="strongAuthenticationPhoneNumber" />
     
                <!-- Optional claims -->
                <OutputClaim ClaimTypeReferenceId="userPrincipalName" />
                <OutputClaim ClaimTypeReferenceId="displayName" />
                <OutputClaim ClaimTypeReferenceId="accountEnabled" />
                <OutputClaim ClaimTypeReferenceId="otherMails" />
                <OutputClaim ClaimTypeReferenceId="signInNames.emailAddress" />
              </OutputClaims>
              <OutputClaimsTransformations>
                <OutputClaimsTransformation ReferenceId="AssertAccountEnabledIsTrue" />
              </OutputClaimsTransformations>
              <IncludeTechnicalProfile ReferenceId="AAD-Common" />
            </TechnicalProfile>
  

Этот профиль ищет пользователя и возвращается с сообщением об ошибке, если пользователь не был найден в AD. Однако я хочу показать пользователю кнопку для регистрации после выполнения проверки. Как я могу этого добиться?

Любая помощь будет оценена!

Ответ №1:

Пользовательская политика Azure AD B2C теперь является продуктом общего доступа, и к ней доступно множество хорошей документации.

То, чего вы хотите достичь здесь, очень распространено и было объяснено в starter pack. Это называется политикой signuporsignin. Просмотрите статью https://learn.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-get-started-custom

Вы также можете ознакомиться с политиками здесь https://github.com/Azure-Samples/active-directory-b2c-custom-policy-starterpack/blob/master/SocialAndLocalAccountsWithMfa/TrustFrameworkBase.xml

Посмотрите на этот технический профиль https://github.com/Azure-Samples/active-directory-b2c-custom-policy-starterpack/blob/master/SocialAndLocalAccountsWithMfa/TrustFrameworkBase.xml#L981

предоставление этих метаданных может помочь

              <Metadata>
                <Item Key="SignUpTarget">SignUpWithLogonEmailExchange</Item>
                <Item Key="setting.operatingMode">Email</Item>
                <Item Key="ContentDefinitionReferenceId">api.selfasserted</Item>
              </Metadata>