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
In this article, you add a new user provided entry (a claim) to your sign-up or sign-in policy in Azure Active Directory B2C (Azure AD B2C). You configure a city entry as a dropdown, and define whether it's required.
20
+
In this article, you will collect a new attribute during your sign-up journey in Azure Active Directory B2C (Azure AD B2C). You will obtain the users' City, configure it as a dropdown, and define whether it's required to be provided.
21
21
22
22
Gathering initial data from your users is achieved using the sign-up or sign-in user journey. Additional claims can be gathered later by using a profile edit user journey. Anytime Azure AD B2C gathers information directly from the user interactively, the Identity Experience Framework uses its [self-asserted technical profile](self-asserted-technical-profile.md). In this sample, you:
23
23
24
-
1. Define a city claim.
24
+
1. Define a 'city' claim.
25
25
1. Ask the user for their city.
26
-
1. Persist the city to the user profile in Azure AD directory
27
-
1. Read the city claim from the user profile.
28
-
1. Return the city to your relying party application.
26
+
1. Persist the city to the user profile in Azure AD B2C directory.
27
+
1. Read the city claim from the user profile on each sign in.
28
+
1. Return the city to your relying party application after sign in or sign up.
29
29
30
30
## Prerequisites
31
31
32
-
Complete the steps in [Get started with custom policies](custom-policy-get-started.md). You should have a working custom policy for sign-up and sign-in with local accounts.
32
+
Complete the steps in [Get started with custom policies](custom-policy-get-started.md). You should have a working custom policy for sign-up and sign-in with social and local accounts.
33
33
34
34
## Define a claim
35
35
@@ -40,7 +40,7 @@ A claim provides a temporary storage of data during an Azure AD B2C policy execu
40
40
-**UserHelpText** - Helps the user understand what is required.
41
41
-[UserInputType](claimsschema.md#userinputtype) - The type of input control, such as textbox, radio selection, drop-down list, or multiple selections.
42
42
43
-
Open the extensions file of your policy. For example, <em>`SocialAndLocalAccounts/`**`TrustFrameworkExtensions.xml`**</em>. This extensions file is one of the policy files included in the custom policy starter pack, which you should have obtained in the prerequisite, [Get started with custom policies](https://docs.microsoft.com/azure/active-directory-b2c/active-directory-b2c-get-started-custom).
43
+
Open the extensions file of your policy. For example, <em>`SocialAndLocalAccounts/`**`TrustFrameworkExtensions.xml`**</em>.
44
44
45
45
1. Search for the [BuildingBlocks](buildingblocks.md) element. If the element doesn't exist, add it.
46
46
1. Locate the [ClaimsSchema](claimsschema.md) element. If the element doesn't exist, add it.
@@ -61,13 +61,13 @@ Open the extensions file of your policy. For example, <em>`SocialAndLocalAccount
61
61
62
62
## Add a claim to the user interface
63
63
64
-
Following technical profiles are [self-asserted](self-asserted-technical-profile.md), where a user is expected to provide input:
64
+
The following technical profiles are [self-asserted](self-asserted-technical-profile.md), invoked when a user is expected to provide input:
65
65
66
66
-**LocalAccountSignUpWithLogonEmail** - Local account sign-up flow.
67
67
-**SelfAsserted-Social** - Federated account first-time user sign-in.
To add the city claim as an `<OutputClaim ClaimTypeReferenceId="city"/>` to the technical profiles, you override them in the extension policy. You specify the entire list of the output claims, to control the order the claims are presented on the screen. Find the **ClaimsProviders** element. Add a new ClaimsProviders as follows:
70
+
To collect the City claim during Sign Up, it must be added as an output claim to the `LocalAccountSignUpWithLogonEmail`technical profile. Override this technical profile in the extension file. Specify the entire list of output claims to control the order the claims are presented on the screen. Find the **ClaimsProviders** element. Add a new ClaimsProviders as follows:
71
71
72
72
```xml
73
73
<ClaimsProvider>
@@ -88,6 +88,10 @@ To add the city claim as an `<OutputClaim ClaimTypeReferenceId="city"/>` to the
88
88
</TechnicalProfiles>
89
89
</ClaimsProvider>
90
90
<ClaimsProvider>
91
+
```
92
+
93
+
To collect the City claim after initial sign in with Social Account, it must be added as an output claim to the `SelfAsserted-Social` technical profile. For Social Account users to be able to edit their profile data later, add the output claim to the `SelfAsserted-ProfileUpdate` technical profile. Override these technical profiles in the extension file. Specify the entire list of the output claims to control the order the claims are presented on the screen. Find the **ClaimsProviders** element. Add a new ClaimsProviders as follows:
94
+
```xml
91
95
<DisplayName>Self Asserted</DisplayName>
92
96
<TechnicalProfiles>
93
97
<!--Federated account first-time sign-in page-->
@@ -114,9 +118,10 @@ To add the city claim as an `<OutputClaim ClaimTypeReferenceId="city"/>` to the
114
118
115
119
## Read and write a claim
116
120
117
-
To persist the city to the user profile in the directory, you add `<PersistedClaim ClaimTypeReferenceId="city"/>` to the relevant technical profiles. To read the city from the user profile in the directory, you add `<OutputClaim ClaimTypeReferenceId="city"/>`.
121
+
The following technical profiles are [Active Directory technical profile](active-directory-technical-profile.md), which read and write data to the Azure Active Directory.
122
+
Use `PersistedClaims` to write data to the user profile and `OutputClaims` to read data from the user profile within the respective Active Directory technical profiles.
118
123
119
-
The following technical profiles are [Active Directory technical profile](active-directory-technical-profile.md), which read and write data to the Azure Active Directory. Find the **ClaimsProviders** element. Add a new ClaimsProviders as follows:
124
+
Find the **ClaimsProviders** element. Add a new ClaimsProviders as follows:
120
125
121
126
```xml
122
127
<ClaimsProvider>
@@ -158,9 +163,9 @@ The following technical profiles are [Active Directory technical profile](active
158
163
159
164
## Include a claim in the token
160
165
161
-
To return the city claim back to the relaying party application, add the `<OutputClaim ClaimTypeReferenceId="city" />`claim to the SignUpOrSignIn.xml file so that this claim is sent to the application in the token after a successful user journey. Modify the `TechnicalProfile Id="PolicyProfile"` element to add the city output claim as `<OutputClaim ClaimTypeReferenceId="city" />`.
166
+
To return the city claim back to the relying party application, add an output claim to the <em>`SocialAndLocalAccounts/`**`SignUpOrSignIn.xml`**</em> file. This will issue the claim into the token after a successful user journey, and will be sent to the application. Modify the technical profile element within the relying party section to add the city as an output claim.
162
167
163
-
Your final relying party should look like following XML snippet:
168
+
Your final relying party should look like the following:
0 commit comments