Reputation: 2577
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:
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
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