Skip to content

Commit a3f2293

Browse files
authored
Merge pull request #103230 from yoelhor/patch-27
Update string-transformations.md
2 parents 9e15903 + 6203e77 commit a3f2293

File tree

1 file changed

+112
-1
lines changed

1 file changed

+112
-1
lines changed

articles/active-directory-b2c/string-transformations.md

Lines changed: 112 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ manager: celestedg
99
ms.service: active-directory
1010
ms.workload: identity
1111
ms.topic: reference
12-
ms.date: 02/03/2020
12+
ms.date: 02/04/2020
1313
ms.author: marsma
1414
ms.subservice: B2C
1515
---
@@ -495,6 +495,47 @@ Use this claims transformation to parse the domain name after the @ symbol of th
495495
- Output claims:
496496
- **domain**: outlook.com
497497

498+
## SetClaimsIfRegexMatch
499+
500+
Checks that a string claim `claimToMatch` and `matchTo` input parameter are equal, and sets the output claims with the value present in `outputClaimIfMatched` input parameter, along with compare result output claim, which is to be set as `true` or `false` based on the result of comparison.
501+
502+
| Item | TransformationClaimType | Data Type | Notes |
503+
| ---- | ----------------------- | --------- | ----- |
504+
| inputClaim | claimToMatch | string | The claim type, which is to be compared. |
505+
| InputParameter | matchTo | string | The regular expression to match. |
506+
| InputParameter | outputClaimIfMatched | string | The value to be set if strings are equal. |
507+
| OutputClaim | outputClaim | string | If regular expression is match, this output claim contains the value of `outputClaimIfMatched` input parameter. Or null, if no match. |
508+
| OutputClaim | regexCompareResultClaim | boolean | The regular expression match result output claim type, which is to be set as `true` or `false` based on the result of matching. |
509+
510+
For example, checks whether the provided phone number is valid, based on phone number regular expression pattern.
511+
512+
```XML
513+
<ClaimsTransformation Id="SetIsPhoneRegex" TransformationMethod="setClaimsIfRegexMatch">
514+
<InputClaims>
515+
<InputClaim ClaimTypeReferenceId="phone" TransformationClaimType="claimToMatch" />
516+
</InputClaims>
517+
<InputParameters>
518+
<InputParameter Id="matchTo" DataType="string" Value="^[0-9]{4,16}$" />
519+
<InputParameter Id="outputClaimIfMatched" DataType="string" Value="isPhone" />
520+
</InputParameters>
521+
<OutputClaims>
522+
<OutputClaim ClaimTypeReferenceId="validationResult" TransformationClaimType="outputClaim" />
523+
<OutputClaim ClaimTypeReferenceId="isPhoneBoolean" TransformationClaimType="regexCompareResultClaim" />
524+
</OutputClaims>
525+
</ClaimsTransformation>
526+
```
527+
528+
### Example
529+
530+
- Input claims:
531+
- **claimToMatch**: "64854114520"
532+
- Input parameters:
533+
- **matchTo**: "^[0-9]{4,16}$"
534+
- **outputClaimIfMatched**: "isPhone"
535+
- Output claims:
536+
- **outputClaim**: "isPhone"
537+
- **regexCompareResultClaim**: true
538+
498539
## SetClaimsIfStringsAreEqual
499540

500541
Checks that a string claim and `matchTo` input parameter are equal, and sets the output claims with the value present in `stringMatchMsg` and `stringMatchMsgCode` input parameters, along with compare result output claim, which is to be set as `true` or `false` based on the result of comparison.
@@ -703,3 +744,73 @@ For example, normalize a phone number, by removing the `-` characters
703744
- Output claims:
704745
- **outputClaim**: "+164411452054"
705746

747+
## StringJoin
748+
749+
Concatenates the elements of a specified string collection claim type, using the specified separator between each element or member.
750+
751+
| Item | TransformationClaimType | Data Type | Notes |
752+
| ---- | ----------------------- | --------- | ----- |
753+
| InputClaim | inputClaim | stringCollection | A collection that contains the strings to concatenate. |
754+
| InputParameter | delimiter | string | The string to use as a separator, such as comma `,`. |
755+
| OutputClaim | outputClaim | string | A string that consists of the members of the `inputClaim` string collection, delimited by the `delimiter` input parameter. |
756+
757+
The following example takes a string collection of user roles, and convert it to a comma delimiter string. You can user this method to store a string collection in Azure AD user account. Later, when you read the account from the directory, use the `StringSplit` to convert the comma delimiter string back to string collection.
758+
759+
```XML
760+
<ClaimsTransformation Id="ConvertRolesStringCollectionToCommaDelimiterString" TransformationMethod="StringJoin">
761+
<InputClaims>
762+
<InputClaim ClaimTypeReferenceId="roles" TransformationClaimType="inputClaim" />
763+
</InputClaims>
764+
<InputParameters>
765+
<InputParameter DataType="string" Id="delimiter" Value="," />
766+
</InputParameters>
767+
<OutputClaims>
768+
<OutputClaim ClaimTypeReferenceId="rolesCommaDelimiterConverted" TransformationClaimType="outputClaim" />
769+
</OutputClaims>
770+
</ClaimsTransformation>
771+
```
772+
773+
### Example
774+
775+
- Input claims:
776+
- **inputClaim**: [ "Admin", "Author", "Reader" ]
777+
- Input parameters:
778+
- **delimiter**: ","
779+
- Output claims:
780+
- **outputClaim**: "Admin,Author,Reader"
781+
782+
783+
## StringSplit
784+
785+
Returns a string array that contains the substrings in this instance that are delimited by elements of a specified string.
786+
787+
| Item | TransformationClaimType | Data Type | Notes |
788+
| ---- | ----------------------- | --------- | ----- |
789+
| InputClaim | inputClaim | string | A string claim type that contains the sub strings to split. |
790+
| InputParameter | delimiter | string | The string to use as a separator, such as comma `,`. |
791+
| OutputClaim | outputClaim | stringCollection | A string collection whose elements contain the substrings in this string that are delimited by the `delimiter` input parameter. |
792+
793+
The following example takes a comma delimiter string of user roles, and convert it to a string collection.
794+
795+
```XML
796+
<ClaimsTransformation Id="ConvertRolesToStringCollection" TransformationMethod="StringSplit">
797+
<InputClaims>
798+
<InputClaim ClaimTypeReferenceId="rolesCommaDelimiter" TransformationClaimType="inputClaim" />
799+
</InputClaims>
800+
<InputParameters>
801+
<InputParameter DataType="string" Id="delimiter" Value="," />
802+
</InputParameters>
803+
<OutputClaims>
804+
<OutputClaim ClaimTypeReferenceId="roles" TransformationClaimType="outputClaim" />
805+
</OutputClaims>
806+
</ClaimsTransformation>
807+
```
808+
809+
### Example
810+
811+
- Input claims:
812+
- **inputClaim**: "Admin,Author,Reader"
813+
- Input parameters:
814+
- **delimiter**: ","
815+
- Output claims:
816+
- **outputClaim**: [ "Admin", "Author", "Reader" ]

0 commit comments

Comments
 (0)