Search code examples
azure-ad-b2cclaims

Send text of Enumeration in OutputClaim in Azure B2C


I have some custom claim "extension_country" which is kind of DropDownSelect:

<ClaimType Id="extension_country">
  <DisplayName>Country</DisplayName>
  <DataType>string</DataType>
  <UserInputType>DropdownSingleSelect</UserInputType>
  <Restriction>
    <Enumeration Value="AFGHANISTAN" Text="afghanistan" SelectByDefault="false" />
    <Enumeration Value="ALBANIA" Text="albania" SelectByDefault="false" />
    <Enumeration Value="ALGERIA" Text="algeria" SelectByDefault="false" />
    [...]
    </Restriction>
  </ClaimType>

No I want to sent the text as an OutputClaim in my RelayParty:

<OutputClaim ClaimTypeReferenceId="extension_country" PartnerClaimType="Country" />

But Azure B2C is just sending the value, not the text. I send this claim to other applications which will import it to user profile. So in my apps the country is "BOSNIAANDHERZEGOVINA" which is really bad to read. "bosnia and herzegovina" would be much better. I did not find any ClaimsTransformation to do this. There is some in other direction (get text and set value), but I need value to text.

As I will localize the dropdown in the future, it would be really nice to send the text every time in english.

Best


Solution

  • I changed the definition now like @jas suri has written. Changed the VALUES to readable names. That's not what I would do naturally as programmer and I had to change some more places in my environment, but it's working. Glad that internet technologies has no problems with spaces and special characters in identifiers.