Anup Marwadi
Anup Marwadi

Reputation: 2577

First and Last Name Mandatory in B2C SignUp Policy

We are using B2C Custom Policies and just realized that there doesn't seem to be an easy way to make the first and last name fields mandatory.

Has anyone else been able to figure this out? I have tried the following:

  1. Used a Restriction on the Name field and that seems to work but I can't find the right regex with all combinations for unicode etc.
  2. Added givenName and surname as mandatory fields in the LocalAccountSignUpWithLogonEmail and it still doesn't seem to make any difference

Note that we're using a -New in the profile ID largely because we use some validation technical profiles and it is very difficult to use the same name and add validation technical profiles.

<TechnicalProfile Id="LocalAccountSignUpWithLogonEmail-New">
          <DisplayName>Email signup</DisplayName>
          <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
          <Metadata>
            <Item Key="EnforceEmailVerification">false</Item>
            <Item Key="IpAddressClaimReferenceId">IpAddress</Item>
            <Item Key="ContentDefinitionReferenceId">api.localaccountsignup</Item>
            <Item Key="language.button_continue">Create Account</Item>
            <Item Key="IncludeClaimResolvingInClaimsHandling">true</Item>
            <Item Key="language.local_intro_generic">Sign-In w/ Email</Item>
            <Item Key="language.createaccount_one_link">Don't have an account? Sign Up Now</Item>
          </Metadata>
          <CryptographicKeys>
            <Key Id="issuer_secret" StorageReferenceId="B2C_1A_TokenSigningKeyContainer" />
          </CryptographicKeys>
          <InputClaims>
            <InputClaim ClaimTypeReferenceId="email" />
            <InputClaim ClaimTypeReferenceId="givenName" Required="true" />
            <InputClaim ClaimTypeReferenceId="surName" Required="true" />
            <InputClaim ClaimTypeReferenceId="inviteCode" DefaultValue="{OAUTH-KV:inviteCode}" AlwaysUseDefaultValue="true" />
          </InputClaims>
          <DisplayClaims>
            <DisplayClaim ClaimTypeReferenceId="givenName" />
            <DisplayClaim ClaimTypeReferenceId="surname"/>
            <DisplayClaim ClaimTypeReferenceId="email"/>
            <DisplayClaim ClaimTypeReferenceId="newPassword"/>
            <DisplayClaim ClaimTypeReferenceId="reenterPassword"/>
          </DisplayClaims>
          <OutputClaims>
            <OutputClaim ClaimTypeReferenceId="objectId" />
            <OutputClaim ClaimTypeReferenceId="email" PartnerClaimType="Verified.Email" Required="true" />
            <OutputClaim ClaimTypeReferenceId="newPassword" Required="true" />
            <OutputClaim ClaimTypeReferenceId="reenterPassword" Required="true" />
            <OutputClaim ClaimTypeReferenceId="executed-SelfAsserted-Input" DefaultValue="true" />
            <OutputClaim ClaimTypeReferenceId="authenticationSource" />
            <OutputClaim ClaimTypeReferenceId="newUser" />
            <OutputClaim ClaimTypeReferenceId="givenName" Required="true" />
            <OutputClaim ClaimTypeReferenceId="surName" Required="true" />
            <OutputClaim ClaimTypeReferenceId="crevRoles" PartnerClaimType="roles" />
            <OutputClaim ClaimTypeReferenceId="inviteCode" />
          </OutputClaims>
          <OutputClaimsTransformations>
            <OutputClaimsTransformation ReferenceId="Create-DisplayName"/>
          </OutputClaimsTransformations>
          <ValidationTechnicalProfiles>
            <ValidationTechnicalProfile ReferenceId="REST-CheckIfUserUnique" ContinueOnError="false"/>
            <ValidationTechnicalProfile ReferenceId="AAD-UserWriteUsingLogonEmail" ContinueOnError="false"/>
          </ValidationTechnicalProfiles>
          <UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />
        </TechnicalProfile>

Upvotes: 1

Views: 1120

Answers (1)

rbrayb
rbrayb

Reputation: 46753

Have a look at "LocalAccountSignUpWithLogonEmail" in the base.

It has an input claim of email, no display claims and if you add Required="true" to the two output claims it will work.

Upvotes: 1

Related Questions