1

On the local Account Sign Up form, displayName attribute is not a required field and we don't want to make it a required field.

But when a user does not provide any value for that, it is storing unknown value as it set to that in the policy.

<PersistedClaim ClaimTypeReferenceId="displayName" DefaultValue="unknown" />

I want to set the givenName attribute value as default when it is saving the profile instead of unknown.

I have tried like as below, but not helping

<PersistedClaim ClaimTypeReferenceId="displayName" DefaultValue="{givenName}" />

<PersistedClaim ClaimTypeReferenceId="displayName" 
    PartnerClaimType="givenName" DefaultValue="unknown"  />
spottedmahn
  • 14,823
  • 13
  • 108
  • 178
Lucky
  • 431
  • 3
  • 16
  • This is because AAD considers `displayName` a required field. So even if your policy doesn't enforce it, AAD still needs _something_ there. Is there a reason why you're not requiring `displayName` but _are_ requiring `givenName`? – Marc LaFleur Apr 12 '18 at 15:33
  • @MarcLaFleur, We have few other IDP's like facebook, linkedIn etc are incorporated into the policy which populates the displayName by default, we just want to maintain the same experience not making it a mandatory field across the platform. I am looking if that can be achieved without forcing the user, if not I have to make it mandatory. – Lucky Apr 12 '18 at 16:23

2 Answers2

0

I've never done it, but I believe this is where we can use ClaimsTransformations. It's not really documented so I can't point you in the direction of good howto's .

Borrowing from this SO answer, I believe you can do this:

<ClaimsTransformation Id="CreateDisplayNameFromGivenName" TransformationMethod="FormatStringClaim">
  <InputClaims>
    <InputClaim ClaimTypeReferenceId="displayName" TransformationClaimType="inputClaim" />
  </InputClaims>
  <InputParameters>
    <InputParameter Id="stringFormat" DataType="string" Value="{0}" />
  </InputParameters>
  <OutputClaims>
    <OutputClaim ClaimTypeReferenceId="email" TransformationClaimType="givenName" />
  </OutputClaims>
</ClaimsTransformation>

Then you need to call your ClaimsTransformation in your TechnicalProfile.

<TechnicalProfile Id="LocalAccount-Registration-GivenName">
  <DisplayName>Hello World 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.registration</Item>
    <Item Key="IpAddressClaimReferenceId">IpAddress</Item>
    <Item Key="language.button_continue">Create</Item>
  </Metadata>
  <CryptographicKeys>
    <Key Id="issuer_secret" StorageReferenceId="TokenSigningKeyContainer" />
  </CryptographicKeys>
  <InputClaimsTransformations>
    <InputClaimsTransformation ReferenceId="CreateDisplayNameFromGivenName" />
  </InputClaimsTransformations>
  <InputClaims>
    ...
  </InputClaims>
  <OutputClaims>
    ...
  </OutputClaims>
  <ValidationTechnicalProfiles>
    <ValidationTechnicalProfile ReferenceId="AzureActiveDirectoryStore-WriteUserByEmail-ThrowIfExists" />
  </ValidationTechnicalProfiles>
  <UseTechnicalProfileForSessionManagement ReferenceId="SSOSession-AzureActiveDirectory" />
</TechnicalProfile>
spottedmahn
  • 14,823
  • 13
  • 108
  • 178
-2

check link below it may help you sir.its to late im sorry https://learn.microsoft.com/en-us/azure/active-directory-b2c/active-directory-technical-profile

Adnan Bashir
  • 645
  • 4
  • 8