Issue with passing locale to Claim Transformation

Soni, Ashish 21 Reputation points
2023-03-13T13:43:37.6366667+00:00

Hi @Shweta Mathur @AmanpreetSingh-MSFT ,

Could you please help me with below issue?

We are using custom email service to send OTP for email verification. In order to achieve this, we are using ClaimTransformation to generate JSON request for the custom service.

In Extensions file, ClaimTransformation looks like this:

<ClaimsTransformations>
      <ClaimsTransformation Id="GenerateEmailRequestBody" TransformationMethod="GenerateJson">
        <InputClaims>
          <InputClaim ClaimTypeReferenceId="email" TransformationClaimType="email"/>
          <InputClaim ClaimTypeReferenceId="otp" TransformationClaimType="otp"/>
        </InputClaims>
        <InputParameters>
          <InputParameter Id="language" DataType="string" Value="{Culture:RFC5646}"/>
        </InputParameters>
        <OutputClaims>
          <OutputClaim ClaimTypeReferenceId="emailRequestBody" TransformationClaimType="outputClaim"/>
        </OutputClaims>
      </ClaimsTransformation>
    </ClaimsTransformations>

When we try sending the request, our service gets only "en" as request. Expectation is to recieve a json request with email, otp and locale value. Other fields are not present in request.

Could you please confirm what am I doing wrong here?

Thanks

Ashish

Azure Active Directory
Azure Active Directory
An Azure enterprise identity service that provides single sign-on and multi-factor authentication.
13,510 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Shweta Mathur 12,906 Reputation points Microsoft Employee
    2023-03-15T06:56:03.9133333+00:00

    Hi @Soni, Ashish ,

    Thanks for reaching out.

    I understand you are trying to get claim values ('email', 'otp') or constants ('en') to generate a JSON string but only getting locale value in the JSON.

    To get claim values and constants to generate a JSON string, you need to add JSON objects to JSON array following dot notation which is used to indicate where to insert the data into a JSON string.

    <ClaimsTransformations>
          <ClaimsTransformation Id="GenerateEmailRequestBody" TransformationMethod="GenerateJson">
            <InputClaims>
              <InputClaim ClaimTypeReferenceId="email" TransformationClaimType="value.0.email"/>
              <InputClaim ClaimTypeReferenceId="otp" TransformationClaimType="value.0.otp"/>
            </InputClaims>
            <InputParameters>
              <InputParameter Id="value.1.language" DataType="string" Value="{Culture:RFC5646}"/>
            </InputParameters>
            <OutputClaims>
              <OutputClaim ClaimTypeReferenceId="emailRequestBody" TransformationClaimType="outputClaim"/>
            </OutputClaims>
          </ClaimsTransformation>
        </ClaimsTransformations>
    
    {
      "value": [
        {
          "email": "someone@microsoft.com",
          "otp": "123456"
        },
    
       {
          "language": "en"
        },
    ]
    }
    
    

    Hope this will help.

    Thanks,

    Shweta

    Please remember to "Accept Answer" if answer helped you.