Skip to content

Commit 9b84f9e

Browse files
authored
Merge pull request #185126 from MicrosoftDocs/master
1/14 AM Publish
2 parents b55c580 + ea545d3 commit 9b84f9e

33 files changed

+243
-147
lines changed

articles/active-directory-b2c/TOC.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
href: openid-connect.md
7777
- name: Authorization Code grant flow
7878
href: authorization-code-flow.md
79+
displayName: pkce, Proof Key for Code Exchange
7980
- name: Implicit flow
8081
href: implicit-flow-single-page-application.md
8182
- name: Tokens

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

Lines changed: 89 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,34 @@ manager: CelesteDG
88
ms.service: active-directory
99
ms.workload: identity
1010
ms.topic: reference
11-
ms.date: 02/16/2020
11+
ms.date: 1/14/2022
1212
ms.author: kengaderdus
1313
ms.subservice: B2C
1414
ms.custom: "b2c-support"
1515
---
1616

1717
# Date 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 date 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
## AssertDateTimeIsGreaterThan
2422

25-
Checks that one date and time claim (string data type) is later than a second date and time claim (string data type), and throws an exception.
23+
Asserts that one date is later than a second date. Determines whether the `rightOperand` is greater than the `leftOperand`. If yes, throws an exception.
2624

2725
| Item | TransformationClaimType | Data Type | Notes |
2826
| ---- | ----------------------- | --------- | ----- |
2927
| InputClaim | leftOperand | string | First claim's type, which should be later than the second claim. |
3028
| InputClaim | rightOperand | string | Second claim's type, which should be earlier than the first claim. |
31-
| InputParameter | AssertIfEqualTo | boolean | Specifies whether this assertion should throw an error if the left operand is equal to the right operand. An error will be thrown if the left operand is equal to the right operand and the value is set to `true`. Possible values: `true` (default), or `false`. |
29+
| InputParameter | AssertIfEqualTo | boolean | Specifies whether this assertion should throw an error if the left operand is equal to the right operand. Possible values: `true` (default), or `false`. |
3230
| InputParameter | AssertIfRightOperandIsNotPresent | boolean | Specifies whether this assertion should pass if the right operand is missing. |
3331
| InputParameter | TreatAsEqualIfWithinMillseconds | int | Specifies the number of milliseconds to allow between the two date times to consider the times equal (for example, to account for clock skew). |
3432

3533
The **AssertDateTimeIsGreaterThan** claims transformation is always executed from a [validation technical profile](validation-technical-profile.md) that is called by a [self-asserted technical profile](self-asserted-technical-profile.md). The **DateTimeGreaterThan** self-asserted technical profile metadata controls the error message that the technical profile presents to the user. The error messages can be [localized](localization-string-ids.md#claims-transformations-error-messages).
3634

3735
![AssertStringClaimsAreEqual execution](./media/date-transformations/assert-execution.png)
3836

37+
### AssertDateTimeIsGreaterThan example
38+
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

4141
```xml
@@ -56,44 +56,60 @@ The following example compares the `currentDateTime` claim with the `approvedDat
5656
> In the example above, if you remove the `AssertIfEqualTo` input parameter, and the `currentDateTime` is equal to`approvedDateTime`, an error will be thrown. The `AssertIfEqualTo` default value is `true`.
5757
>
5858
59-
The `login-NonInteractive` validation technical profile calls the `AssertApprovedDateTimeLaterThanCurrentDateTime` claims transformation.
59+
- Input claims:
60+
- **leftOperand**: 2022-01-01T15:00:00
61+
- **rightOperand**: 2022-01-22T15:00:00
62+
- Input parameters:
63+
- **AssertIfEqualTo**: false
64+
- **AssertIfRightOperandIsNotPresent**: true
65+
- **TreatAsEqualIfWithinMillseconds**: 300000 (30 seconds)
66+
- Result: Error thrown
67+
68+
### Call the claims transformation
69+
70+
The following `Example-AssertDates` validation technical profile calls the `AssertApprovedDateTimeLaterThanCurrentDateTime` claims transformation.
71+
6072
```xml
61-
<TechnicalProfile Id="login-NonInteractive">
62-
...
73+
<TechnicalProfile Id="Example-AssertDates">
74+
<DisplayName>Unit test</DisplayName>
75+
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.ClaimsTransformationProtocolProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
76+
<OutputClaims>
77+
<OutputClaim ClaimTypeReferenceId="ComparisonResult" DefaultValue="false" />
78+
</OutputClaims>
6379
<OutputClaimsTransformations>
64-
<OutputClaimsTransformation ReferenceId="AssertApprovedDateTimeLaterThanCurrentDateTime" />
80+
<OutputClaimsTransformation ReferenceId="AssertDates" />
6581
</OutputClaimsTransformations>
82+
<UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop" />
6683
</TechnicalProfile>
6784
```
6885

69-
The self-asserted technical profile calls the validation **login-NonInteractive** technical profile.
86+
The self-asserted technical profile calls the validation `Example-AssertDates` technical profile.
7087

7188
```xml
72-
<TechnicalProfile Id="SelfAsserted-LocalAccountSignin-Email">
89+
<TechnicalProfile Id="SelfAsserted-AssertDateTimeIsGreaterThan">
90+
<DisplayName>User ID signup</DisplayName>
91+
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
7392
<Metadata>
74-
<Item Key="DateTimeGreaterThan">Custom error message if the provided left operand is greater than the right operand.</Item>
93+
<Item Key="ContentDefinitionReferenceId">api.selfasserted</Item>
94+
<Item Key="DateTimeGreaterThan">Custom error message if the provided right operand is greater than the right operand.</Item>
7595
</Metadata>
96+
...
7697
<ValidationTechnicalProfiles>
77-
<ValidationTechnicalProfile ReferenceId="login-NonInteractive" />
98+
<ValidationTechnicalProfile ReferenceId="ClaimsTransformation-AssertDateTimeIsGreaterThan" />
7899
</ValidationTechnicalProfiles>
79100
</TechnicalProfile>
80101
```
81102

82-
### Example
83-
84-
- Input claims:
85-
- **leftOperand**: 2020-03-01T15:00:00.0000000Z
86-
- **rightOperand**: 2020-03-01T14:00:00.0000000Z
87-
- Result: Error thrown
88-
89103
## ConvertDateToDateTimeClaim
90104

91-
Converts a **Date** ClaimType to a **DateTime** ClaimType. The claims transformation converts the time format and adds 12:00:00 AM to the date.
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.
92106

93107
| Item | TransformationClaimType | Data Type | Notes |
94108
| ---- | ----------------------- | --------- | ----- |
95-
| InputClaim | inputClaim | date | The ClaimType to be converted. |
96-
| OutputClaim | outputClaim | dateTime | The ClaimType that is produced after this ClaimsTransformation has been invoked. |
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
97113

98114
The following example demonstrates the conversion of the claim `dateOfBirth` (date data type) to another claim `dateOfBirthWithTime` (dateTime data type).
99115

@@ -108,21 +124,21 @@ The following example demonstrates the conversion of the claim `dateOfBirth` (da
108124
</ClaimsTransformation>
109125
```
110126

111-
### Example
112-
113127
- Input claims:
114-
- **inputClaim**: 2020-15-03
128+
- **inputClaim**: 2022-01-03
115129
- Output claims:
116-
- **outputClaim**: 2020-15-03T00:00:00.0000000Z
130+
- **outputClaim**: 2022-01-03T00:00:00.0000000Z
117131

118132
## ConvertDateTimeToDateClaim
119133

120-
Converts a **DateTime** ClaimType to a **Date** ClaimType. The claims transformation removes the time format from the date.
134+
Converts a `DateTime` claim type to a `Date` claim type. The claims transformation removes the time format from the date.
121135

122136
| Item | TransformationClaimType | Data Type | Notes |
123137
| ---- | ----------------------- | --------- | ----- |
124-
| InputClaim | inputClaim | dateTime | The ClaimType to be converted. |
125-
| OutputClaim | outputClaim | date | The ClaimType that is produced after this ClaimsTransformation has been invoked. |
138+
| InputClaim | inputClaim | dateTime | The claim type to be converted. |
139+
| OutputClaim | outputClaim | date | The claim type that is produced after this claims transformation has been invoked. |
140+
141+
### ConvertDateTimeToDateClaim example
126142

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

@@ -137,54 +153,35 @@ The following example demonstrates the conversion of the claim `systemDateTime`
137153
</ClaimsTransformation>
138154
```
139155

140-
### Example
141-
142156
- Input claims:
143-
- **inputClaim**: 2020-15-03T11:34:22.0000000Z
157+
- **inputClaim**: 2022-01-03T11:34:22.0000000Z
144158
- Output claims:
145-
- **outputClaim**: 2020-15-03
146-
147-
## GetCurrentDateTime
148-
149-
Get the current UTC date and time and add the value to a ClaimType.
150-
151-
| Item | TransformationClaimType | Data Type | Notes |
152-
| ---- | ----------------------- | --------- | ----- |
153-
| OutputClaim | currentDateTime | dateTime | The ClaimType that is produced after this ClaimsTransformation has been invoked. |
154-
155-
```xml
156-
<ClaimsTransformation Id="GetSystemDateTime" TransformationMethod="GetCurrentDateTime">
157-
<OutputClaims>
158-
<OutputClaim ClaimTypeReferenceId="systemDateTime" TransformationClaimType="currentDateTime" />
159-
</OutputClaims>
160-
</ClaimsTransformation>
161-
```
162-
163-
### Example
164-
165-
* Output claims:
166-
* **currentDateTime**: 2020-15-03T11:40:35.0000000Z
159+
- **outputClaim**: 2022-01-03
167160

168161
## DateTimeComparison
169162

170-
Determine whether one dateTime is later, earlier, or equal to another. The result is a new boolean ClaimType boolean with a value of `true` or `false`.
163+
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`.
171164

172165
| Item | TransformationClaimType | Data Type | Notes |
173166
| ---- | ----------------------- | --------- | ----- |
174-
| InputClaim | firstDateTime | dateTime | The first dateTime to compare whether it is earlier or later than the second dateTime. Null value throws an exception. |
175-
| InputClaim | secondDateTime | dateTime | The second dateTime to compare whether it is earlier or later than the first dateTime. Null value is treated as the current datetTime. |
167+
| InputClaim | firstDateTime | dateTime | The first date to compare whether it's later, earlier, or equal to the second date. Null value throws an exception. |
168+
| InputClaim | secondDateTime | dateTime | The second date to compare. Null value is treated as the current datetTime. |
169+
| InputParameter | timeSpanInSeconds | int | Timespan to add to the first date. Possible values: range from negative -2,147,483,648 through positive 2,147,483,647. |
176170
| InputParameter | operator | string | One of following values: same, later than, or earlier than. |
177-
| InputParameter | timeSpanInSeconds | int | Add the timespan to the first datetime. |
178-
| OutputClaim | result | boolean | The ClaimType that is produced after this ClaimsTransformation has been invoked. |
171+
| OutputClaim | result | boolean | The claim that is produced after this claims transformation has been invoked. |
172+
173+
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.
174+
To run the claim transformation, you first need to get the current date and also the last time user accepts the TOS.
175+
176+
### DateTimeComparison example
179177

180-
Use this claims transformation to determine if two ClaimTypes are equal, later, or earlier than each other. For example, you may store the last time a user accepted your terms of services (TOS). After 3 months, you can ask the user to access the TOS again.
181-
To run the claim transformation, you first need to get the current dateTime and also the last time user accepts the TOS.
178+
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).
182179

183180
```xml
184181
<ClaimsTransformation Id="CompareLastTOSAcceptedWithCurrentDateTime" TransformationMethod="DateTimeComparison">
185182
<InputClaims>
186-
<InputClaim ClaimTypeReferenceId="currentDateTime" TransformationClaimType="firstDateTime" />
187183
<InputClaim ClaimTypeReferenceId="extension_LastTOSAccepted" TransformationClaimType="secondDateTime" />
184+
<InputClaim ClaimTypeReferenceId="currentDateTime" TransformationClaimType="firstDateTime" />
188185
</InputClaims>
189186
<InputParameters>
190187
<InputParameter Id="operator" DataType="string" Value="later than" />
@@ -196,13 +193,38 @@ To run the claim transformation, you first need to get the current dateTime and
196193
</ClaimsTransformation>
197194
```
198195

199-
### Example
200-
201196
- Input claims:
202-
- **firstDateTime**: 2020-01-01T00:00:00.100000Z
203-
- **secondDateTime**: 2020-04-01T00:00:00.100000Z
197+
- **firstDateTime**: 2022-01-01T00:00:00.100000Z
198+
- **secondDateTime**: 2022-03-16T00:00:00.100000Z
204199
- Input parameters:
205200
- **operator**: later than
206201
- **timeSpanInSeconds**: 7776000 (90 days)
207202
- Output claims:
208203
- **result**: true
204+
205+
## GetCurrentDateTime
206+
207+
Get the current UTC date and time and add the value to a claim type.
208+
209+
| Item | TransformationClaimType | Data Type | Notes |
210+
| ---- | ----------------------- | --------- | ----- |
211+
| OutputClaim | currentDateTime | dateTime | The claim type that is produced after this claims transformation has been invoked. |
212+
213+
### GetCurrentDateTime example
214+
215+
The following example shows how to get the current data and time:
216+
217+
```xml
218+
<ClaimsTransformation Id="GetSystemDateTime" TransformationMethod="GetCurrentDateTime">
219+
<OutputClaims>
220+
<OutputClaim ClaimTypeReferenceId="systemDateTime" TransformationClaimType="currentDateTime" />
221+
</OutputClaims>
222+
</ClaimsTransformation>
223+
```
224+
225+
* Output claims:
226+
* **currentDateTime**: 2022-01-14T11:40:35.0000000Z
227+
228+
## Next steps
229+
230+
- 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/general-transformations.md

Lines changed: 13 additions & 9 deletions
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: 01/14/2022
1313
ms.author: kengaderdus
1414
ms.subservice: B2C
1515
---
@@ -18,16 +18,16 @@ ms.subservice: B2C
1818

1919
[!INCLUDE [active-directory-b2c-advanced-audience-warning](../../includes/active-directory-b2c-advanced-audience-warning.md)]
2020

21-
This article provides examples for using general claims transformations of the Identity Experience Framework schema in Azure Active Directory B2C (Azure AD B2C). For more information, see [ClaimsTransformations](claimstransformations.md).
21+
This article provides examples for using general claims transformations of the Identity Experience Framework schema in Azure Active Directory B2C (Azure AD B2C). For more information, see [claims transformations](claimstransformations.md).
2222

2323
## CopyClaim
2424

2525
Copy value of a claim to another. Both claims must be from the same type.
2626

2727
| Item | TransformationClaimType | Data Type | Notes |
2828
| ---- | ----------------------- | --------- | ----- |
29-
| InputClaim | inputClaim | string, int | The claim type which is to be copied. |
30-
| OutputClaim | outputClaim | string, int | The ClaimType that is produced after this ClaimsTransformation has been invoked. |
29+
| InputClaim | inputClaim | string, int | The claim type, which is to be copied. |
30+
| OutputClaim | outputClaim | string, int | The claim that is produced after this claims transformation has been invoked. |
3131

3232
Use this claims transformation to copy a value from a string or numeric claim, to another claim. The following example copies the externalEmail claim value to email claim.
3333

@@ -42,7 +42,7 @@ Use this claims transformation to copy a value from a string or numeric claim, t
4242
</ClaimsTransformation>
4343
```
4444

45-
### Example
45+
### CopyClaim example
4646

4747
- Input claims:
4848
- **inputClaim**: [email protected]
@@ -56,7 +56,7 @@ Checks if the **inputClaim** exists or not and sets **outputClaim** to true or f
5656
| Item | TransformationClaimType | Data Type | Notes |
5757
| ---- | ----------------------- | --------- | ----- |
5858
| InputClaim | inputClaim |Any | The input claim whose existence needs to be verified. |
59-
| OutputClaim | outputClaim | boolean | The ClaimType that is produced after this ClaimsTransformation has been invoked. |
59+
| OutputClaim | outputClaim | boolean | The claim that is produced after this claims transformation has been invoked. |
6060

6161
Use this claims transformation to check if a claim exists or contains any value. The return value is a boolean that indicates whether the claim exists. Following example checks if the email address exists.
6262

@@ -71,7 +71,7 @@ Use this claims transformation to check if a claim exists or contains any value.
7171
</ClaimsTransformation>
7272
```
7373

74-
### Example
74+
### DoesClaimExist example
7575

7676
- Input claims:
7777
- **inputClaim**: [email protected]
@@ -87,7 +87,7 @@ Hash the provided plain text using the salt and a secret. The hashing algorithm
8787
| InputClaim | plaintext | string | The input claim to be encrypted |
8888
| InputClaim | salt | string | The salt parameter. You can create a random value, using `CreateRandomString` claims transformation. |
8989
| InputParameter | randomizerSecret | string | Points to an existing Azure AD B2C **policy key**. To create a new policy key: In your Azure AD B2C tenant, under **Manage**, select **Identity Experience Framework**. Select **Policy keys** to view the keys that are available in your tenant. Select **Add**. For **Options**, select **Manual**. Provide a name (the prefix *B2C_1A_* might be added automatically.). In the **Secret** text box, enter any secret you want to use, such as 1234567890. For **Key usage**, select **Signature**. Select **Create**. |
90-
| OutputClaim | hash | string | The ClaimType that is produced after this claims transformation has been invoked. The claim configured in the `plaintext` inputClaim. |
90+
| OutputClaim | hash | string | The claim that is produced after this claims transformation has been invoked. The claim configured in the `plaintext` inputClaim. |
9191

9292
```xml
9393
<ClaimsTransformation Id="HashPasswordWithEmail" TransformationMethod="Hash">
@@ -104,11 +104,15 @@ Hash the provided plain text using the salt and a secret. The hashing algorithm
104104
</ClaimsTransformation>
105105
```
106106

107-
### Example
107+
### Hash example
108108

109109
- Input claims:
110110
- **plaintext**: MyPass@word1
111111
- **salt**: 487624568
112112
- **randomizerSecret**: B2C_1A_AccountTransformSecret
113113
- Output claims:
114114
- **outputClaim**: CdMNb/KTEfsWzh9MR1kQGRZCKjuxGMWhA5YQNihzV6U=
115+
116+
## Next steps
117+
118+
- 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

0 commit comments

Comments
 (0)