Azure AD B2C Custom Policy with Sign Up Page Only

2019-08-17 08:56发布

问题:

I want to create a custom policy in Azure AD B2C. I can't find such an example in the starterpack (https://github.com/Azure-Samples/active-directory-b2c-custom-policy-starterpack).

I checked this post Azure AD B2C Link to Sign Up Page (Not Sign In) and if I understand it correctly there is no url I can use of existing custom signup_signin policy to end up directly in Sign Up page. Creating "Sign up v2" flow works, but I need a custom one and coping code from the build in one and placing it to the LocalAccounts example from the starterpack doesn't work.

This is the UserJourney code downloaded from "Sign up v2" flow

    <UserJourney Id="B2CSignUp_V2"> <OrchestrationSteps> <OrchestrationStep 
    Order="1" Type="ClaimsProviderSelection" 
    ContentDefinitionReferenceId="api.idpselections.signup"> 
    <ClaimsProviderSelections> <ClaimsProviderSelection 
    TargetClaimsExchangeId="SignUpWithLogonEmailExchange" /> 
    </ClaimsProviderSelections> </OrchestrationStep> </OrchestrationSteps> 
    </UserJourney>

I tried to replace the OrchestrationStep 1 and 2 from the starterpack with the one here but it doesn't work.

回答1:

In your Custom policies, In the B2C_1A_TrustFrameworkBase.xml file replace the 1st Orchestration Step for the User Journey Id="SignUpOrSignIn" with the following Orchestration Step and you will be directly landed to Signup page -

<OrchestrationStep Order="1" Type="ClaimsProviderSelection" ContentDefinitionReferenceId="api.idpselections.signup">
<ClaimsProviderSelections>
<ClaimsProviderSelection TargetClaimsExchangeId="SignUpWithLogonEmailExchange" />
</ClaimsProviderSelections>
</OrchestrationStep>


回答2:

Alternatively, you can:

  • Remove orchestration step 1
  • Remove the objectId precondition from orchestration step 2
  • Renumber the following orchestration steps

Such as:

<OrchestrationStep Order="1" Type="ClaimsExchange">
  <ClaimsExchanges>
    <ClaimsExchange Id="SignUpWithLogonEmailExchange" TechnicalProfileReferenceId="LocalAccountSignUpWithLogonEmail" />
  </ClaimsExchanges>
</OrchestrationStep>
<OrchestrationStep Order="2" Type="ClaimsExchange">
  <ClaimsExchanges>
    <ClaimsExchange Id="AADUserReadWithObjectId" TechnicalProfileReferenceId="AAD-UserReadUsingObjectId" />
  </ClaimsExchanges>
</OrchestrationStep>
<OrchestrationStep Order="3" Type="SendClaims" CpimIssuerTechnicalProfileReferenceId="JwtIssuer" />