You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/active-directory-b2c/contentdefinitions.md
+54-25Lines changed: 54 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
---
2
-
title: ContentDefinitions - Azure Active Directory B2C | Microsoft Docs
2
+
title: ContentDefinitions
3
+
titleSuffix: Azure AD B2C
3
4
description: Specify the ContentDefinitions element of a custom policy in Azure Active Directory B2C.
4
5
services: active-directory-b2c
5
6
author: mmacy
@@ -8,7 +9,7 @@ manager: celestedg
8
9
ms.service: active-directory
9
10
ms.workload: identity
10
11
ms.topic: reference
11
-
ms.date: 09/10/2018
12
+
ms.date: 02/10/2020
12
13
ms.author: marsma
13
14
ms.subservice: B2C
14
15
---
@@ -52,7 +53,6 @@ The metadata of the **LocalAccountSignUpWithLogonEmail** self-asserted technical
52
53
...
53
54
```
54
55
55
-
56
56
## ContentDefinition
57
57
58
58
The **ContentDefinition** element contains the following attribute:
@@ -68,22 +68,59 @@ The **ContentDefinition** element contains the following elements:
68
68
| LoadUri | 1:1 | A string that contains the URL of the HTML5 page for the content definition. |
69
69
| RecoveryUri | 0:1 | A string that contains the URL of the HTML page for displaying an error relating to the content definition. |
70
70
| DataUri | 1:1 | A string that contains the relative URL of an HTML file that provides the user experience to invoke for the step. |
71
-
| Metadata |1:1 | A collection of key/value pairs that contains the metadata utilized by the content definition. |
71
+
| Metadata |0:1 | A collection of key/value pairs that contains the metadata utilized by the content definition. |
72
72
| LocalizedResourcesReferences | 0:1 | A collection of localized resources references. Use this element to customize the localization of a user interface and claims attribute. |
73
73
74
74
### DataUri
75
75
76
-
The **DataUri** element is used to specify the page identifier. Azure AD B2C uses the page identifier to load and initiate UI elements and client side JavaScript. The format of the value is `urn:com:microsoft:aad:b2c:elements:page-name:version`. The following table lists the values and descriptions of the page identifiers you can use.
76
+
The **DataUri** element is used to specify the page identifier. Azure AD B2C uses the page identifier to load and initiate UI elements and client side JavaScript. The format of the value is `urn:com:microsoft:aad:b2c:elements:page-name:version`. The following table lists the page identifiers you can use.
77
77
78
-
|Value |Description |
78
+
|Page identifier |Description |
79
79
| ----- | ----------- |
80
-
|`urn:com:microsoft:aad:b2c:elements:globalexception:1.1.0`| Displays an error page when an exception or an error is encountered. |
81
-
|`urn:com:microsoft:aad:b2c:elements:idpselection:1.0.0`| Lists the identity providers that users can choose from during sign-in. |
82
-
|`urn:com:microsoft:aad:b2c:elements:unifiedssp:1.0.0`| Displays a form for signing in with a local account that's based on an email address or a user name. This value also provides the “keep me sign-in functionality” and “Forgot your password?” link. |
83
-
|`urn:com:microsoft:aad:b2c:elements:unifiedssd:1.0.0`| Displays a form for signing in with a local account that's based on an email address or a user name. |
84
-
|`urn:com:microsoft:aad:b2c:elements:multifactor:1.1.0`| Verifies phone numbers by using text or voice during sign-up or sign-in. |
85
-
|`urn:com:microsoft:aad:b2c:elements:selfasserted:1.1.0`| Displays a form that enables users to create or update their profile. |
80
+
|`globalexception`| Displays an error page when an exception or an error is encountered. |
81
+
|`providerselection`| Lists the identity providers that users can choose from during sign-in. |
82
+
|`unifiedssp`| Displays a form for signing in with a local account that's based on an email address or a user name. This value also provides the “keep me sign-in functionality” and “Forgot your password?” link. |
83
+
|`unifiedssp`| Displays a form for signing in with a local account that's based on an email address or a user name. |
84
+
|`multifactor`| Verifies phone numbers by using text or voice during sign-up or sign-in. |
85
+
|`selfasserted`| Displays a form that enables users to create or update their profile. |
86
+
87
+
## Select a page layout
88
+
89
+
You can enable [JavaScript client-side code](javascript-samples.md) by inserting `contract` between `elements` and the page type. For example, `urn:com:microsoft:aad:b2c:elements:contract:page-name:version`.
The [version](page-layout.md) part of the `DataUri` specifies the package of content containing HTML, CSS, and JavaScript for the user interface elements in your policy. If you intend to enable JavaScript client-side code, the elements you base your JavaScript on must be immutable. If they're not immutable, any changes could cause unexpected behavior on your user pages. To prevent these issues, enforce the use of a page layout and specify a page layout version. Doing so ensures that all content definitions you’ve based your JavaScript on are immutable. Even if you don’t intend to enable JavaScript, you still need to specify the page layout version for your pages.
94
+
95
+
The following example shows the **DataUri** of `selfasserted` version `1.2.0`:
The format of the value must contain the word `contract`: _urn:com:microsoft:aad:b2c:elements:**contract**:page-name:version_. To specify a page layout in your custom policies that use an old **DataUri** value, use following table to migrate to the new format.
The following example shows a sign-up or sign-in content definition with a reference to localization for English, French and Spanish:
117
141
118
142
```XML
@@ -150,3 +174,8 @@ The ID attribute of the **ContentDefinition** element specifies the type of page
150
174
|**api.selfasserted.profileupdate**|[updateprofile.cshtml](https://login.microsoftonline.com/static/tenant/default/updateProfile.cshtml)|**Profile update page** - Displays a form that users can access to update their profile. This page is similar to the social account sign up page, except for the password entry fields. |
151
175
|**api.signuporsignin**|[unified.cshtml](https://login.microsoftonline.com/static/tenant/default/unified.cshtml)|**Unified sign-up or sign-in page** - Handles the user sign-up and sign-in process. Users can use enterprise identity providers, social identity providers such as Facebook or Google+, or local accounts. |
152
176
177
+
## Next steps
178
+
179
+
For an example of customizing the user interface by using content definitions, see:
180
+
181
+
[Customize the user interface of your application using a custom policy](custom-policy-ui-customization.md)
You can add your own JavaScript client-side code to your Azure Active Directory B2C (Azure AD B2C) applications. To enable JavaScript for your applications, you must add an element to your [custom policy](custom-policy-overview.md), select a [page layout](page-layout.md), and use [b2clogin.com](b2clogin.md) in your requests. This article describes how you can change your custom policy to enable script execution.
21
+
You can add your own JavaScript client-side code to your Azure Active Directory B2C (Azure AD B2C) applications.
22
+
23
+
To enable JavaScript for your applications:
24
+
25
+
* Add an element to your [custom policy](custom-policy-overview.md)
26
+
* Select a [page layout](page-layout.md)
27
+
* Use [b2clogin.com](b2clogin.md) in your requests
28
+
29
+
This article describes how you can change your custom policy to enable script execution.
21
30
22
31
> [!NOTE]
23
32
> If you want to enable JavaScript for user flows, see [JavaScript and page layout versions in Azure Active Directory B2C](user-flow-javascript-overview.md).
@@ -26,9 +35,9 @@ You can add your own JavaScript client-side code to your Azure Active Directory
26
35
27
36
### Select a page layout
28
37
29
-
*[Select a page layout](page-layout.md) for the user interface elements of your application.
38
+
* Select a [page layout](contentdefinitions.md#select-a-page-layout) for the user interface elements of your application.
30
39
31
-
If you intend to use JavaScript, you need to [define a page layout version](page-layout.md#replace-datauri-values) for *all* of the content definitions in your custom policy.
40
+
If you intend to use JavaScript, you need to [define a page layout version](contentdefinitions.md#migrating-to-page-layout) with page `contract` version for *all* of the content definitions in your custom policy.
32
41
33
42
## Add the ScriptExecution element
34
43
@@ -48,25 +57,7 @@ You enable script execution by adding the **ScriptExecution** element to the [Re
48
57
```
49
58
3. Save and upload the file.
50
59
51
-
## Guidelines for using JavaScript
52
-
53
-
Follow these guidelines when you customize the interface of your application using JavaScript:
54
-
55
-
- Don't bind a click event on `<a>` HTML elements.
56
-
- Don’t take a dependency on Azure AD B2C code or comments.
57
-
- Don't change the order or hierarchy of Azure AD B2C HTML elements. Use an Azure AD B2C policy to control the order of the UI elements.
58
-
- You can call any RESTful service with these considerations:
59
-
- You may need to set your RESTful service CORS to allow client-side HTTP calls.
60
-
- Make sure your RESTful service is secure and uses only the HTTPS protocol.
61
-
- Don't use JavaScript directly to call Azure AD B2C endpoints.
62
-
- You can embed your JavaScript or you can link to external JavaScript files. When using an external JavaScript file, make sure to use the absolute URL and not a relative URL.
63
-
- JavaScript frameworks:
64
-
- Azure AD B2C uses a specific version of jQuery. Don’t include another version of jQuery. Using more than one version on the same page causes issues.
65
-
- Using RequireJS isn't supported.
66
-
- Most JavaScript frameworks are not supported by Azure AD B2C.
67
-
- Azure AD B2C settings can be read by calling `window.SETTINGS`, `window.CONTENT` objects, such as the current UI language. Don’t change the value of these objects.
68
-
- To customize the Azure AD B2C error message, use localization in a policy.
69
-
- If anything can be achieved by using a policy, generally it's the recommended way.
0 commit comments