Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

String claims transformations unit tests

This folder contains unit tests for Azure AD B2C string claims transformations. For more information, check out the String claims transformations article.

AssertStringClaimsAreEqual

Asserts whether the string1 claim is identical to the string2 claim. An error is thrown if the string1 and string2 aren't identical. It allows you to select the type of the conversion Ordinal (case sensitive), or ordinalIgnoreCase (ignore case).

The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1 and string2 claims with default values (you can change the values). Select the type of the conversion Ordinal (case sensitive), or ordinalIgnoreCase (ignore case). Select Continue the run the validation technical profiles.
  • ExperimentalValidation-[option] - claims transformation type of validation technical profile. This validation technical profile invokes the AssertStringsAreEqual-[option] claims transformation, which runs the assertion with the corresponding case sensitive/insensitive configuration.
  • AssertStringsAreEqual-[option] claims transformations - the unit tests.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

BuildUri

Combines the user's unique identifier uriLabel claim, and a secret key secretKey claims. The result of this unit test is a result claim that contains a time based on time password (TOTP) URI. Some of the parameters can't be changed via the user interface. To change these values, edit the CreateUriString claims transformation input parameters scheme, host and query.issuer.

The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the uriLabel and secretKey claims with default values (you can change the values). The output claims transformation CreateUriString runs the unit test. Select Continue to run the next orchestration step that shows the result.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the result of this unit test.
  • CreateUriString claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

ChangeCase

Changes the case of inputValue claim to lower or upper case into the result claim. It allows you to select the type of the change to upper or lower case. The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the inputValue claim with default value (you can change the values). Select the type of the conversion lower, or upper. Then, select Continue to run the validation technical profiles.
  • ExperimentalValidation-[option] - claims transformation type of validation technical profile. This validation technical profile invokes the corresponding ChangeInputValueTo[option] claims transformation, which changes the string to lower or upper case.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the result of this unit test.
  • ChangeInputValueTo[option] claims transformations - the unit tests.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

CompareClaims

Determines whether string1 claim is equal to string2 claim. It allows you to select the type of the comparison equal, or not equal. You can specify whether the comparison should ignore the case of the strings being compared, by editing the claims transformation ignoreCase input parameter. The result is a new boolean claim result with a value of true or false.

The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1 and string2 claims with default values (you can change the values). Select the type of the comparison equal, or not equal. Then, select Continue to run the validation technical profiles.
  • ExperimentalValidation-[option] - claims transformation type of validation technical profile. This validation technical profile invokes the CheckStrings-[option] claims transformation, which checks if the claims are equal or not.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the result of this unit test.
  • CheckStrings-[option] claims transformations - the unit tests.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

CompareClaimToValue

Determines whether string1 claim is equal to a predefined string ABC. It allows you to select the type of the comparison equal, or not equal. You can specify whether the comparison should ignore the case of the strings being compared, by editing the claims transformation ignoreCase input parameter. Also you can change the predefined string ABC to any string, by changing the compareTo input parameter. The result is a new boolean claim result with a value of true or false.

The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1 and string2 claims with default values (you can change the values). Select the type of the comparison equal, or not equal. Then, select Continue to run the validation technical profiles.
  • ExperimentalValidation-[option] - claims transformation type of validation technical profile. This validation technical profile invokes the corresponding CheckStrings-[option] claims transformation, which checks if the claims are equal or not.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the result of this unit test.
  • CheckStrings-[option] claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

CopyClaimIfPredicateMatch

Tries to copy the string1 claim value to result claim. It will copy the value only if the string1 is in international phone number format, as configured in the internationalOrNationalPhoneNumber predicate.

When you provide a valid phone number, the claim will be copy to the result. When you select Continue, you'll see the exact same value on the result page. But if you provide any string, such as email address, the result claim will be empty.

The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1 claim with default values (you can change the values). The output claims transformation SetResultIfPredicateMatch runs the unit test. Select Continue to run the next orchestration step that shows the result.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the result of this unit test.
  • CreateUriString claims transformation - the unit test.
  • internationalOrNationalPhoneNumber predicate that checks whether the user's input is in international phone number format.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

CreateOtpSecret

Creates a TOTP string claim. The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. The input claims transformation SetResultIfPredicateMatch of this technical profile runs the CreateOtpSecret.
  • CreateOtpSecret claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

CreateRandomString

Creates a random string using the random number or GUID generator. The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile lets you choose the type of the transformation. Then, select Continue to run the validation technical profiles.
  • Validation technical profiles (type of claims transformation):
    • ExperimentalValidation-Integer - invokes the CreateIntegerRandomValue claims transformation, which creates an integer random value.
    • ExperimentalValidation-IntegerWithFormat - invokes the CreateIntegerWithFormatRandomValue claims transformation, which creates an integer random value. The return value is formatted ID_{the random value}.
    • ExperimentalValidation-IntegerWithFormatWithBase64 - invokes the CreateIntegerWithFormatRandomValue claims transformation, which creates an integer random value. The return value is formatted ID_{the random value} then converted into base64.
    • ExperimentalValidation-GUID - invokes the CreateGUIDRandomValue claims transformation, which creates a GUID random value.
    • ExperimentalValidation-GUIDWithFormat - invokes the CreateGUIDWithFormatRandomValue claims transformation, which creates a GUID random value. The return value is formatted ID_{the random value}.
    • ExperimentalValidation-GUIDWithFormatWithBase64 - invokes the CreateGUIDWithFormatRandomValue claims transformation, which creates a GUID random value. The return value is formatted ID_{the random value} then converted into base64.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the result of this unit test.
  • Claims transformations:
    • CreateIntegerRandomValue - creates an integer random value unit test.
    • CreateIntegerWithFormatRandomValue - creates an integer random value with format unit test.
    • CreateIntegerWithFormatWithBase64RandomValue - creates an integer random value with format, and base64 unit test.
    • CreateGUIDRandomValue - creates a GUID random value unit test.
    • CreateGUIDWithFormatRandomValue - creates a GUID random value with format unit test.
    • CreateGUIDWithFormatWithBase64RandomValue - creates a GUID random value with format, and base64 unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

CreateStringClaim

Sets the value of the result claim to Contoso terms of service.... The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile calls the SetStringClaimValue input claims transformation. Then renders the result output claim to the screen.
  • SetStringClaimValue claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

FormatLocalizedString

Formats the string1, string2 and string3 claims according to a provided localized format string. The result of this unit test is a result claim that contains new formatted string. The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1, string2 and string3 claims with default values (you can change the values). The output claims transformation SetResponseMessage runs the unit test. Select Continue to run the next orchestration step that shows the result.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the result of this unit test.
  • SetResponseMessage claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

FormatStringClaim

Formats the string1 claim according to the provided format string. The result of this unit test is a result claim that contains new formatted string. The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1 claim with a default value (you can change the value). The output claims transformation FormatString1 runs the unit test. Select Continue to run the next orchestration step that shows the result.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the result of this unit test.
  • FormatString1 claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

FormatStringMultipleClaims

Formats the string1 and string2 claims according to the provided format string. The result of this unit test is a result claim that contains new formatted string. The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1 and string2 claim with a default value (you can change the value). The output claims transformation FormatString1AndString2 runs the unit test. Select Continue to run the next orchestration step that shows the result.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the result of this unit test.
  • FormatString1AndString2 claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

GetLocalizedStringsTransformation

Copies localized strings into the string1, string2, string3, and string4 claims. The result of this unit test is a result claim that contains the corresponding values from the LocalizedString element.

The unit test policy supports the English (en) and Spanish (es) languages. Check the policy with the browser's default language and explicitly provide the ui_locales query string parameter with other languages. For example, default language, Spanish. Other languages that are not configured in this policy, such as German will return empty values. To avoid such a case (empty values), make sure you include of all the required languages in your policy.

The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile calls the GetLocalizedStringsForEmail input claims transformation. Then renders the result output claim to the screen.
  • GetLocalizedStringsForEmail claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

GetMappedValueFromLocalizedCollection

Looks up a localized string of the result claim and sets the value to the result claim. The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the code claim with a default value (you can change the value). The code that you provide is used to search for the corresponding Item localization element's Text. The output claims transformation GetValueByCode runs the unit test. Select Continue to run the next orchestration step that shows the result.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the result of this unit test.
  • GetValueByCode claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

LookupValue

Looks up a value from a list of values in the GetValueById claims transformation input parameters collections. The lookup is done based on the value of the idToLookup. The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the idToLookup claim with a default value (you can change the value). The idToLookup that you provide is used to search for the corresponding Id input parameter. Note, if you select the fabrikam.com value, an empty string will be return. Since there isn't such ID in the claims transformation. The output claims transformation GetValueById runs the unit test. Select Continue to run the next orchestration step that shows the result.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the result of this unit test.
  • GetValueById claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

NullClaim

Cleans the value of the string1 claim. The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1 claim with a default value (you can change the value). The output claims transformation NullString runs the unit test. Select Continue to run the next orchestration step that shows the result.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the string1 with empty string.
  • GetValueById claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

ParseDomain

Gets the domain portion of the string1 email. The result of this unit test is a result claim that contains the domain part of the string1 claim. If the provide email address isn't valid an empty string return. The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1 claim with a default value (you can change the value). The output claims transformation GetDomainName runs the unit test. Select Continue to run the next orchestration step that shows the result.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the result of this unit test.
  • GetDomainName claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

SetClaimIfBooleansMatch

Checks that the boolean1 claim is true, or false. If true, sets the result output claim with the value present in outputClaimIfMatched input parameter of the SetClaimIfBooleansClaimIsTrue claims transformation.

The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the boolean1 claim with a default value (you can change the value). The output claims transformation SetClaimIfBooleansClaimIsTrue runs the unit test. Select Continue to run the next orchestration step that shows the result.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the result of this unit test.
  • SetClaimIfBooleansClaimIsTrue claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

SetClaimsIfRegexMatch

Checks that the string1 claim is matched to the CheckIfStringsAreEqual claims transformation's matchTo input parameter (a phone number format). If match, sets the:

  • resultValue output claims with the value present in outputClaimIfMatched input parameter.
  • resultMatch output claim with true or false based on the result of comparison.

The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1 claim with a default value (you can change the value). The output claims transformation SetIfString1RegexMatch runs the unit test. Select Continue to run the next orchestration step that shows the result.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the resultValue, resultCode, and resultMatch claims.
  • SetIfString1RegexMatch claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

SetClaimsIfRegexMatch with Groups

Checks that the string1 claim is matched to the CheckIfStringsAreEqual claims transformation's matchTo input parameter (email format). This mode of the claims transformation also should extract the Regex group values. If match, sets the:

  • resultValue output claims with the value present in outputClaimIfMatched input parameter.
  • resultGroup1 output claims with the Regex group as configured in the matchTo input parameter.
  • resultMatch output claim with true or false based on the result of comparison.

The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1 claim with a default value (you can change the value). The output claims transformation SetIfString1RegexMatch runs the unit test. Select Continue to run the next orchestration step that shows the result.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the resultValue, resultCode, and resultMatch claims.
  • SetIfString1RegexMatch claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

SetClaimsIfStringsAreEqual

Checks that the string1 claim is matched to the CheckIfStringsAreEqual claims transformation's matchTo input parameter. If match, sets the:

  • resultValue output claims with the value present in stringMatchMsg input parameters.
  • resultCode output claims with the value present in stringMatchMsgCode input parameters
  • resultMatch output claim with true or false based on the result of comparison.

The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1 claim with a default value (you can change the value). The output claims transformation CheckIfStringsAreEqual runs the unit test. Select Continue to run the next orchestration step that shows the result.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the resultValue, resultCode, and resultMatch claims.
  • CheckIfStringsAreEqual claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

SetClaimsIfStringsMatch

Checks that the string1 claim is matched to the CheckIfStringMatch claims transformation's matchTo input parameter. If match, sets the result output claims with the value present in outputClaimIfMatched input parameter, along with compare result resultMatch claim, which is to be set as true or false based on the result of comparison.

The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1 claim with a default value (you can change the value). The output claims transformation CheckIfStringMatch runs the unit test. Select Continue to run the next orchestration step that shows the result.
  • ResultTechnicalProfile - self-asserted technical profile.This technical profile shows the result of this unit test.
  • CheckIfStringMatch claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

StringContains

Determines whether a specified substring occurs within the string1 claim. The result is the result claim with a value of true or false. true if the value parameter occurs within this string, otherwise, false. You can whether to ignore case or not.

The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1 claim with a default value (you can change the value). Select whether to ignore case (case insensitive), nor (case sensitive). Select Continue the run the validation technical profiles.
  • Validation technical profiles (type of claims transformation):
    • ExperimentalValidation-IgnoreCase - invokes the CheckIsString1Contains-IgnoreCase claims transformation, which searches the substring with case insensitive configuration.
    • ExperimentalValidation-RespectCase - invokes the CheckIsString1Contains-RespectCase claims transformation, which searches the substring with case sensitive configuration.
  • Claims transformations:
    • CheckIsString1Contains-IgnoreCase claims transformation - the case insensitive unit test.
    • CheckIsString1Contains-RespectCase claims transformation - the case sensitive unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

StringJoin

Concatenates the elements of the groups string collection claim, using the specified separator between each element or member. The result is the result claim which a comma delimiter string of the groups string collection.

To test the functionality of the StringJoin claims transformation, we first collect the string1 and string2 claims. Then We add these claims to the groups string collection using the AddString1 and AddString2 claims transformation. After the claims are added to the string collection, the unit test converts them back to the result string claim type.

The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1 and string2 claims with default values (you can change the values). The technical profile runs the following claims transformations:
    1. AddString1 adds the string1 to the groups claim.
    2. AddString2 adds the string2 to the groups claim.
    3. ConvertStringCollectionToCommaDelimiterString runs the unit test.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the result of this unit test.
  • ConvertStringCollectionToCommaDelimiterString claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

StringReplace

Searches the string1 claim type string for a specified value (-) as specified in the NormalizePhoneNumber claims transformation's oldValue input parameter, and replaces with the value of the newValue input parameter (empty string). The result of this unit test is a result claim that contains the new string (after the replacement). The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1 claim with a default value (you can change the value). The output claims transformation NormalizePhoneNumber runs the unit test. Select Continue to run the next orchestration step that shows the result.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the result of this unit test.
  • NormalizePhoneNumber claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

StringSplit

Splits the string1 claim into the result string collection of substrings. It splits the string using the comma delimiter (-) as configure in the ConvertStringToStringCollection claims transformation's delimiter input claim. The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1 claim with a default value (you can change the value). The output claims transformation ConvertStringToStringCollection runs the unit test. Select Continue to get an ID token with the string collection.
  • ConvertStringToStringCollection claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation

StringSubstring

Extracts parts of the string1 claim type, beginning at the character at the specified position, and returns the specified number of characters. The unit test defines the following elements:

  • ExperimentalTechnicalProfile - self-asserted technical profile. This technical profile renders the string1 claim with a default value (you can change the value). The output claims transformation GetCodePrefix runs the unit test. Select Continue to run the next orchestration step that shows the result.
  • ResultTechnicalProfile - self-asserted technical profile. This technical profile shows the result of this unit test.
  • GetCodePrefix claims transformation - the unit test.

live demo Live demo   Quick deploy Quick deploy   policy Policy   documentation Documentation