A FormatStringMultipleClaims transformation formats two claims 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 result is returned as the transformation’s output claim.
InputClaims |
TransformationClaimType |
Description |
inputClaim1 |
The first claim whose value is to be formatted |
inputClaim2 |
The second 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 ‘inputClaim1’, and ‘{1}’ will be replaced by the value of ‘inputClaim2’ |
OutputClaims |
TransformationClaimType |
Description |
outputClaim |
The formatted claim |
Example |
This example defines a ClaimsTransformation of the ‘FormatStringMultipleClaims’ type called ‘CreateDisplayName’. A policy schema’s ‘givenName’ and ‘surname’ claims are formatted using a format string in which ‘{0}’ will be replaced by ‘givenName’ and ‘{1}’ will be replaced by ‘surname’ . The result will be returned in the ‘displayName’ claim from the policy schema.
<ClaimsTransformation Id="CreateDisplayName" TransformationMethod="FormatStringMultipleClaims"> <InputClaims> <InputClaim ClaimTypeReferenceId="givenName" TransformationClaimType="inputClaim1" /> <InputClaim ClaimTypeReferenceId="surname" TransformationClaimType="inputClaim2" /> </InputClaims> <InputParameters> <InputParameter Id="formatString" DataType="string" Value="{0} {1}" /> </InputParameters> <OutputClaims> <OutputClaim ClaimTypeReferenceId="displayName" TransformationClaimType="outputClaim" /> </OutputClaims> </ClaimsTransformation>