FormatStringClaim Transformation

A FormatStringClaim transformation formats a claim defined in the policy schema by using a format string defined as an input parameter.  The format string is applied using the .NET System.String Format method. The formatted claim is returned as the transformation’s output claim.

 

InputClaims

TransformationClaimType

Description

inputClaim

The claim whose value is to be formatted

InputParameters

Id

DataType Value

stringFormat

boolean A string in which ‘{0}’ will be replaced by the value of the claim being formatted

OutputClaims

TransformationClaimType

Description

outputClaim

The formatted claim

Example

This example defines a ClaimsTransformation of the ‘FormatStringClaim’ type called ‘CreateUserPrincipalName’. A claim called ‘userId’ in the policy Schema is formatted using a format string in which {0} will be replaced the claim being formatted .  The result will be returned in the ‘userPrincipalName’ claim from the policy schema.

      
<ClaimsTransformation Id="CreateUserPrincipalName" TransformationMethod="FormatStringClaim">
        <InputClaims>
          <InputClaim ClaimTypeReferenceId="userId" TransformationClaimType="inputClaim" />
        </InputClaims>
        <InputParameters>
          <InputParameter Id="formatString" DataType="string" Value="cpim_{0}@cpimb2c.ccsctp.net" />
        </InputParameters>
        <OutputClaims>
          <OutputClaim ClaimTypeReferenceId="userPrincipalName" TransformationClaimType="outputClaim" />
        </OutputClaims>
      </ClaimsTransformation>

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.