Skip to content

Commit 6dbe188

Browse files
committed
Claims transformations improvements
1 parent ce5e70d commit 6dbe188

9 files changed

+654
-575
lines changed

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

Lines changed: 49 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@ manager: CelesteDG
99
ms.service: active-directory
1010
ms.workload: identity
1111
ms.topic: reference
12-
ms.date: 06/06/2020
12+
ms.date: 01/16/2022
1313
ms.author: kengaderdus
1414
ms.subservice: B2C
1515
---
1616

1717
# Boolean claims transformations
1818

19-
[!INCLUDE [active-directory-b2c-advanced-audience-warning](../../includes/active-directory-b2c-advanced-audience-warning.md)]
20-
2119
This article provides examples for using the boolean claims transformations of the Identity Experience Framework schema in Azure Active Directory B2C (Azure AD B2C). For more information, see [ClaimsTransformations](claimstransformations.md).
2220

2321
## AndClaims
@@ -30,6 +28,9 @@ Performs an And operation of two boolean inputClaims and sets the outputClaim wi
3028
| InputClaim | inputClaim2 | boolean | The second ClaimType to evaluate. |
3129
|OutputClaim | outputClaim | boolean | The ClaimTypes that will be produced after this claims transformation has been invoked (true or false). |
3230

31+
32+
### Example of AndClaims
33+
3334
The following claims transformation demonstrates how to And two boolean ClaimTypes: `isEmailNotExist`, and `isSocialAccount`. The output claim `presentEmailSelfAsserted` is set to `true` if the value of both input claims are `true`. In an orchestration step, you can use a precondition to preset a self-asserted page, only if a social account email is empty.
3435

3536
```xml
@@ -44,13 +45,11 @@ The following claims transformation demonstrates how to And two boolean ClaimTyp
4445
</ClaimsTransformation>
4546
```
4647

47-
### Example of AndClaims
48-
4948
- Input claims:
50-
- **inputClaim1**: true
51-
- **inputClaim2**: false
49+
- **inputClaim1**: true
50+
- **inputClaim2**: false
5251
- Output claims:
53-
- **outputClaim**: false
52+
- **outputClaim**: false
5453

5554

5655
## AssertBooleanClaimIsEqualToValue
@@ -66,6 +65,8 @@ The **AssertBooleanClaimIsEqualToValue** claims transformation is always execute
6665

6766
![AssertStringClaimsAreEqual execution](./media/boolean-transformations/assert-execution.png)
6867

68+
### Example of AssertBooleanClaimIsEqualToValue
69+
6970
The following claims transformation demonstrates how to check the value of a boolean ClaimType with a `true` value. If the value of the `accountEnabled` ClaimType is false, an error message is thrown.
7071

7172
```xml
@@ -79,38 +80,46 @@ The following claims transformation demonstrates how to check the value of a boo
7980
</ClaimsTransformation>
8081
```
8182

83+
- Input claims:
84+
- **inputClaim**: false
85+
- **valueToCompareTo**: true
86+
- Result: Error thrown
87+
88+
### Calling the AssertBooleanClaimIsEqualToValue claims transformation
8289

83-
The `login-NonInteractive` validation technical profile calls the `AssertAccountEnabledIsTrue` claims transformation.
90+
The following `Example-AssertBoolean` validation technical profile calls the `AssertAccountEnabledIsTrue` claims transformation.
8491

8592
```xml
86-
<TechnicalProfile Id="login-NonInteractive">
87-
...
93+
<TechnicalProfile Id="Example-AssertBoolean">
94+
<DisplayName>Unit test</DisplayName>
95+
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.ClaimsTransformationProtocolProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
96+
<OutputClaims>
97+
<OutputClaim ClaimTypeReferenceId="ComparisonResult" DefaultValue="false" />
98+
</OutputClaims>
8899
<OutputClaimsTransformations>
89100
<OutputClaimsTransformation ReferenceId="AssertAccountEnabledIsTrue" />
90101
</OutputClaimsTransformations>
102+
<UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop" />
91103
</TechnicalProfile>
92104
```
93105

94-
The self-asserted technical profile calls the validation **login-NonInteractive** technical profile.
106+
The self-asserted technical profile calls the validation `Example-AssertBoolean` technical profile.
95107

96108
```xml
97-
<TechnicalProfile Id="SelfAsserted-LocalAccountSignin-Email">
109+
<TechnicalProfile Id="SelfAsserted-AssertDateTimeIsGreaterThan">
110+
<DisplayName>Example</DisplayName>
111+
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
98112
<Metadata>
113+
<Item Key="ContentDefinitionReferenceId">api.selfasserted</Item>
99114
<Item Key="UserMessageIfClaimsTransformationBooleanValueIsNotEqual">Custom error message if account is disabled.</Item>
100115
</Metadata>
116+
...
101117
<ValidationTechnicalProfiles>
102-
<ValidationTechnicalProfile ReferenceId="login-NonInteractive" />
118+
<ValidationTechnicalProfile ReferenceId="Example-AssertBoolean" />
103119
</ValidationTechnicalProfiles>
104120
</TechnicalProfile>
105121
```
106122

107-
### Example of AssertBooleanClaimIsEqualToValue
108-
109-
- Input claims:
110-
- **inputClaim**: false
111-
- **valueToCompareTo**: true
112-
- Result: Error thrown
113-
114123
## CompareBooleanClaimToValue
115124

116125
Checks that boolean value of a claim is equal to `true` or `false`, and return the result of the compression.
@@ -121,6 +130,8 @@ Checks that boolean value of a claim is equal to `true` or `false`, and return t
121130
| InputParameter |valueToCompareTo | boolean | The value to compare (true or false). |
122131
| OutputClaim | compareResult | boolean | The ClaimType that is produced after this ClaimsTransformation has been invoked. |
123132

133+
### Example of CompareBooleanClaimToValue
134+
124135
The following claims transformation demonstrates how to check the value of a boolean ClaimType with a `true` value. If the value of the `IsAgeOver21Years` ClaimType is equal to `true`, the claims transformation returns `true`, otherwise `false`.
125136

126137
```xml
@@ -137,14 +148,12 @@ The following claims transformation demonstrates how to check the value of a boo
137148
</ClaimsTransformation>
138149
```
139150

140-
### Example of CompareBooleanClaimToValue
141-
142151
- Input claims:
143-
- **inputClaim**: false
152+
- **inputClaim**: false
144153
- Input parameters:
145-
- **valueToCompareTo**: true
154+
- **valueToCompareTo**: true
146155
- Output claims:
147-
- **compareResult**: false
156+
- **compareResult**: false
148157

149158
## NotClaims
150159

@@ -155,7 +164,9 @@ Performs a Not operation of the boolean inputClaim and sets the outputClaim with
155164
| InputClaim | inputClaim | boolean | The claim to be operated. |
156165
| OutputClaim | outputClaim | boolean | The ClaimTypes that are produced after this ClaimsTransformation has been invoked (true or false). |
157166

158-
Use this claim transformation to perform logical negation on a claim.
167+
### Example of NotClaims
168+
169+
The following claim transformation demonstrates how to perform logical negation on a claim.
159170

160171
```xml
161172
<ClaimsTransformation Id="CheckWhetherEmailBePresented" TransformationMethod="NotClaims">
@@ -168,12 +179,10 @@ Use this claim transformation to perform logical negation on a claim.
168179
</ClaimsTransformation>
169180
```
170181

171-
### Example of NotClaims
172-
173182
- Input claims:
174-
- **inputClaim**: false
183+
- **inputClaim**: false
175184
- Output claims:
176-
- **outputClaim**: true
185+
- **outputClaim**: true
177186

178187
## OrClaims
179188

@@ -185,6 +194,8 @@ Computes an Or of two boolean inputClaims and sets the outputClaim with result o
185194
| InputClaim | inputClaim2 | boolean | The second ClaimType to evaluate. |
186195
| OutputClaim | outputClaim | boolean | The ClaimTypes that will be produced after this ClaimsTransformation has been invoked (true or false). |
187196

197+
### Example of OrClaims
198+
188199
The following claims transformation demonstrates how to `Or` two boolean ClaimTypes. In the orchestration step, you can use a precondition to preset a self-asserted page, if the value of one of the claims is `true`.
189200

190201
```xml
@@ -199,10 +210,12 @@ The following claims transformation demonstrates how to `Or` two boolean ClaimTy
199210
</ClaimsTransformation>
200211
```
201212

202-
### Example of OrClaims
203-
204213
- Input claims:
205-
- **inputClaim1**: true
206-
- **inputClaim2**: false
214+
- **inputClaim1**: true
215+
- **inputClaim2**: false
207216
- Output claims:
208-
- **outputClaim**: true
217+
- **outputClaim**: true
218+
219+
## Next steps
220+
221+
- Find more [claims transformation samples](https://github.com/azure-ad-b2c/unit-tests/tree/main/claims-transformation) on the Azure AD B2C community GitHub repo

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

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ manager: CelesteDG
88
ms.service: active-directory
99
ms.workload: identity
1010
ms.topic: reference
11-
ms.date: 1/14/2022
11+
ms.date: 1/16/2022
1212
ms.author: kengaderdus
1313
ms.subservice: B2C
1414
ms.custom: "b2c-support"
@@ -34,7 +34,7 @@ The **AssertDateTimeIsGreaterThan** claims transformation is always executed fro
3434

3535
![AssertStringClaimsAreEqual execution](./media/date-transformations/assert-execution.png)
3636

37-
### AssertDateTimeIsGreaterThan example
37+
### Example of AssertDateTimeIsGreaterThan
3838

3939
The following example compares the `currentDateTime` claim with the `approvedDateTime` claim. An error is thrown if `currentDateTime` is later than `approvedDateTime`. The transformation treats values as equal if they are within 5 minutes (30000 milliseconds) difference. It won't throw an error if the values are equal because `AssertIfEqualTo` is set to `false`.
4040

@@ -57,12 +57,12 @@ The following example compares the `currentDateTime` claim with the `approvedDat
5757
>
5858
5959
- Input claims:
60-
- **leftOperand**: 2022-01-01T15:00:00
61-
- **rightOperand**: 2022-01-22T15:00:00
60+
- **leftOperand**: 2022-01-01T15:00:00
61+
- **rightOperand**: 2022-01-22T15:00:00
6262
- Input parameters:
63-
- **AssertIfEqualTo**: false
64-
- **AssertIfRightOperandIsNotPresent**: true
65-
- **TreatAsEqualIfWithinMillseconds**: 300000 (30 seconds)
63+
- **AssertIfEqualTo**: false
64+
- **AssertIfRightOperandIsNotPresent**: true
65+
- **TreatAsEqualIfWithinMillseconds**: 300000 (30 seconds)
6666
- Result: Error thrown
6767

6868
### Call the claims transformation
@@ -100,35 +100,6 @@ The self-asserted technical profile calls the validation `Example-AssertDates` t
100100
</TechnicalProfile>
101101
```
102102

103-
## ConvertDateToDateTimeClaim
104-
105-
Converts a `Date` claim type to a `DateTime` claim type. The claims transformation converts the time format and adds 12:00:00 AM to the date.
106-
107-
| Item | TransformationClaimType | Data Type | Notes |
108-
| ---- | ----------------------- | --------- | ----- |
109-
| InputClaim | inputClaim | date | The claim type to be converted. |
110-
| OutputClaim | outputClaim | dateTime | The claim type that is produced after this claims transformation has been invoked. |
111-
112-
### ConvertDateToDateTimeClaim example
113-
114-
The following example demonstrates the conversion of the claim `dateOfBirth` (date data type) to another claim `dateOfBirthWithTime` (dateTime data type).
115-
116-
```xml
117-
<ClaimsTransformation Id="ConvertToDateTime" TransformationMethod="ConvertDateToDateTimeClaim">
118-
<InputClaims>
119-
<InputClaim ClaimTypeReferenceId="dateOfBirth" TransformationClaimType="inputClaim" />
120-
</InputClaims>
121-
<OutputClaims>
122-
<OutputClaim ClaimTypeReferenceId="dateOfBirthWithTime" TransformationClaimType="outputClaim" />
123-
</OutputClaims>
124-
</ClaimsTransformation>
125-
```
126-
127-
- Input claims:
128-
- **inputClaim**: 2022-01-03
129-
- Output claims:
130-
- **outputClaim**: 2022-01-03T00:00:00.0000000Z
131-
132103
## ConvertDateTimeToDateClaim
133104

134105
Converts a `DateTime` claim type to a `Date` claim type. The claims transformation removes the time format from the date.
@@ -138,7 +109,7 @@ Converts a `DateTime` claim type to a `Date` claim type. The claims transformati
138109
| InputClaim | inputClaim | dateTime | The claim type to be converted. |
139110
| OutputClaim | outputClaim | date | The claim type that is produced after this claims transformation has been invoked. |
140111

141-
### ConvertDateTimeToDateClaim example
112+
### Example of ConvertDateTimeToDateClaim
142113

143114
The following example demonstrates the conversion of the claim `systemDateTime` (dateTime data type) to another claim `systemDate` (date data type).
144115

@@ -158,6 +129,35 @@ The following example demonstrates the conversion of the claim `systemDateTime`
158129
- Output claims:
159130
- **outputClaim**: 2022-01-03
160131

132+
## ConvertDateToDateTimeClaim
133+
134+
Converts a `Date` claim type to a `DateTime` claim type. The claims transformation converts the time format and adds 12:00:00 AM to the date.
135+
136+
| Item | TransformationClaimType | Data Type | Notes |
137+
| ---- | ----------------------- | --------- | ----- |
138+
| InputClaim | inputClaim | date | The claim type to be converted. |
139+
| OutputClaim | outputClaim | dateTime | The claim type that is produced after this claims transformation has been invoked. |
140+
141+
### Example of ConvertDateToDateTimeClaim
142+
143+
The following example demonstrates the conversion of the claim `dateOfBirth` (date data type) to another claim `dateOfBirthWithTime` (dateTime data type).
144+
145+
```xml
146+
<ClaimsTransformation Id="ConvertToDateTime" TransformationMethod="ConvertDateToDateTimeClaim">
147+
<InputClaims>
148+
<InputClaim ClaimTypeReferenceId="dateOfBirth" TransformationClaimType="inputClaim" />
149+
</InputClaims>
150+
<OutputClaims>
151+
<OutputClaim ClaimTypeReferenceId="dateOfBirthWithTime" TransformationClaimType="outputClaim" />
152+
</OutputClaims>
153+
</ClaimsTransformation>
154+
```
155+
156+
- Input claims:
157+
- **inputClaim**: 2022-01-03
158+
- Output claims:
159+
- **outputClaim**: 2022-01-03T00:00:00.0000000Z
160+
161161
## DateTimeComparison
162162

163163
Compares two dates and determines whether the first date is later, earlier, or equal to another. The result is a new Boolean claim with a value of `true` or `false`.
@@ -173,7 +173,7 @@ Compares two dates and determines whether the first date is later, earlier, or e
173173
Use this claims transformation to determine if first date plus the timespan parameter is later, earlier, or equal to another. For example, you may store the last time a user accepted your terms of services (TOS). After three months, you can ask the user to access the TOS again.
174174
To run the claim transformation, you first need to get the current date and also the last time user accepts the TOS.
175175

176-
### DateTimeComparison example
176+
### Example of DateTimeComparison
177177

178178
The following example shows that the first date (2022-01-01T00:00:00) plus 90 days is later than the second date (2022-03-16T00:00:00).
179179

@@ -194,13 +194,13 @@ The following example shows that the first date (2022-01-01T00:00:00) plus 90 da
194194
```
195195

196196
- Input claims:
197-
- **firstDateTime**: 2022-01-01T00:00:00.100000Z
198-
- **secondDateTime**: 2022-03-16T00:00:00.100000Z
197+
- **firstDateTime**: 2022-01-01T00:00:00.100000Z
198+
- **secondDateTime**: 2022-03-16T00:00:00.100000Z
199199
- Input parameters:
200-
- **operator**: later than
201-
- **timeSpanInSeconds**: 7776000 (90 days)
200+
- **operator**: later than
201+
- **timeSpanInSeconds**: 7776000 (90 days)
202202
- Output claims:
203-
- **result**: true
203+
- **result**: true
204204

205205
## GetCurrentDateTime
206206

@@ -210,7 +210,7 @@ Get the current UTC date and time and add the value to a claim type.
210210
| ---- | ----------------------- | --------- | ----- |
211211
| OutputClaim | currentDateTime | dateTime | The claim type that is produced after this claims transformation has been invoked. |
212212

213-
### GetCurrentDateTime example
213+
### Example of GetCurrentDateTime
214214

215215
The following example shows how to get the current data and time:
216216

@@ -222,8 +222,8 @@ The following example shows how to get the current data and time:
222222
</ClaimsTransformation>
223223
```
224224

225-
* Output claims:
226-
* **currentDateTime**: 2022-01-14T11:40:35.0000000Z
225+
- Output claims:
226+
- **currentDateTime**: 2022-01-14T11:40:35.0000000Z
227227

228228
## Next steps
229229

0 commit comments

Comments
 (0)