azure-ad-b2c / unit-tests

Azure AD B2C custom policies unit tests
33 stars 16 forks source link

Doc inconsistency for CompareClaimToValue transform #4

Open frankdrewes opened 2 years ago

frankdrewes commented 2 years ago

in unit-tests/claims-transformation/string/CT_CompareClaimToValue.xml

the CT "CheckStrings-Equal" doesn't conform to the documentation..

https://docs.microsoft.com/en-us/azure/active-directory-b2c/string-transformations#compareclaimtovalue

the input parameter 'ignoreCase' is documented as being DataType "boolean" but if you use boolean, you get an error similar to

_"Message": "Execution of ClaimsTransformationImpl of Type \"Microsoft.Cpim.Data.Transformations.EqualityTransformation\" for TransformationMethod \"CompareClaimToValue\" of ClaimsTransformation with id \"xxxxxxx\" in policy \"B2C_1A_P1_V1_SuSiUAT\" of tenant \"xxxxxxxx.onmicrosoft.com\" threw an exception with the following message: Unable to cast object of type 'System.Boolean' to type 'System.String'.",

  <ClaimsTransformation Id="CheckStrings-Equal" TransformationMethod="CompareClaimToValue">
        <InputClaims>
          <InputClaim ClaimTypeReferenceId="inputString" TransformationClaimType="inputClaim1" />
        </InputClaims>
        <InputParameters>
          <InputParameter Id="compareTo" DataType="string" Value="ABC" />
          <InputParameter Id="operator" DataType="string" Value="equal" />
          <InputParameter Id="ignoreCase" DataType="string" Value="true" />
        </InputParameters>
        <OutputClaims>
          <OutputClaim ClaimTypeReferenceId="result" TransformationClaimType="outputClaim" />
        </OutputClaims>
      </ClaimsTransformation>

So the code sample is correct, but the docs are incorrect on this point..