Skip to content

Commit f03398f

Browse files
Merge pull request #74298 from davidmu1/linkedin1
engineering change to linkedin setup
2 parents de2c3ca + fb75c33 commit f03398f

File tree

1 file changed

+55
-74
lines changed

1 file changed

+55
-74
lines changed

articles/active-directory-b2c/active-directory-b2c-custom-setup-li-idp.md

Lines changed: 55 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ manager: daveba
88
ms.service: active-directory
99
ms.workload: identity
1010
ms.topic: conceptual
11-
ms.date: 04/01/2019
11+
ms.date: 04/23/2019
1212
ms.author: davidmu
1313
ms.subservice: B2C
1414
---
@@ -47,7 +47,7 @@ To use LinkedIn as an identity provider in Azure AD B2C, you need to create a Li
4747
You need to store the client secret that you previously recorded in your Azure AD B2C tenant.
4848

4949
1. Sign in to the [Azure portal](https://portal.azure.com/).
50-
2. Make sure you're using the directory that contains your Azure AD B2C tenant by clicking the **Directory and subscription filter** in the top menu and choosing the directory that contains your tenant.
50+
2. Make sure you're using the directory that contains your Azure AD B2C tenant. Select the **Directory and subscription filter** in the top menu and choose the directory that contains your tenant.
5151
3. Choose **All services** in the top-left corner of the Azure portal, and then search for and select **Azure AD B2C**.
5252
4. On the Overview page, select **Identity Experience Framework**.
5353
5. Select **Policy Keys** and then select **Add**.
@@ -91,8 +91,8 @@ You can define a LinkedIn account as a claims provider by adding it to the **Cla
9191
</CryptographicKeys>
9292
<OutputClaims>
9393
<OutputClaim ClaimTypeReferenceId="issuerUserId" PartnerClaimType="id" />
94-
<OutputClaim ClaimTypeReferenceId="givenName" PartnerClaimType="firstName" />
95-
<OutputClaim ClaimTypeReferenceId="surname" PartnerClaimType="lastName" />
94+
<OutputClaim ClaimTypeReferenceId="givenName" PartnerClaimType="firstName.localized" />
95+
<OutputClaim ClaimTypeReferenceId="surname" PartnerClaimType="lastName.localized" />
9696
<OutputClaim ClaimTypeReferenceId="identityProvider" DefaultValue="linkedin.com" />
9797
<OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="socialIdpAuthentication" />
9898
</OutputClaims>
@@ -200,7 +200,7 @@ Now that you have a button in place, you need to link it to an action. The actio
200200

201201
## Create an Azure AD B2C application
202202

203-
Communication with Azure AD B2c occurs through an application that you create in your tenant. This section lists optional steps you can complete to create a test application if you haven't already done so.
203+
Communication with Azure AD B2C occurs through an application that you create in your tenant. This section lists optional steps you can complete to create a test application if you haven't already done so.
204204

205205
1. Sign in to the [Azure portal](https://portal.azure.com).
206206
2. Make sure you're using the directory that contains your Azure AD B2C tenant. Select the **Directory and subscription filter** in the top menu and choose the directory that contains your tenant.
@@ -221,67 +221,6 @@ Update the relying party (RP) file that initiates the user journey that you crea
221221
5. Save your changes, upload the file, and then select the new policy in the list.
222222
6. Make sure that Azure AD B2C application that you created is selected in the **Select application** field, and then test it by clicking **Run now**.
223223

224-
225-
## Register the claims provider
226-
227-
At this point, the identity provider has been set up, but it’s not available in any of the sign-up or sign-in screens. To make it available, you create a duplicate of an existing template user journey, and then modify it so that it also has the LinkedIn identity provider.
228-
229-
1. Open the *TrustFrameworkBase.xml* file from the starter pack.
230-
2. Find and copy the entire contents of the **UserJourney** element that includes `Id="SignUpOrSignIn"`.
231-
3. Open the *TrustFrameworkExtensions.xml* and find the **UserJourneys** element. If the element doesn't exist, add one.
232-
4. Paste the entire content of the **UserJourney** element that you copied as a child of the **UserJourneys** element.
233-
5. Rename the ID of the user journey. For example, `SignUpSignInLinkedIn`.
234-
235-
### Display the button
236-
237-
The **ClaimsProviderSelection** element is analogous to an identity provider button on a sign-up or sign-in screen. If you add a **ClaimsProviderSelection** element for a LinkedIn account, a new button shows up when a user lands on the page.
238-
239-
1. Find the **OrchestrationStep** element that includes `Order="1"` in the user journey that you created.
240-
2. Under **ClaimsProviderSelects**, add the following element. Set the value of **TargetClaimsExchangeId** to an appropriate value, for example `LinkedInExchange`:
241-
242-
```XML
243-
<ClaimsProviderSelection TargetClaimsExchangeId="LinkedInExchange" />
244-
```
245-
246-
### Link the button to an action
247-
248-
Now that you have a button in place, you need to link it to an action. The action, in this case, is for Azure AD B2C to communicate with a LinkedIn account to receive a token.
249-
250-
1. Find the **OrchestrationStep** that includes `Order="2"` in the user journey.
251-
2. Add the following **ClaimsExchange** element making sure that you use the same value for the ID that you used for **TargetClaimsExchangeId**:
252-
253-
```XML
254-
<ClaimsExchange Id="LinkedInExchange" TechnicalProfileReferenceId="LinkedIn-OAUTH" />
255-
```
256-
257-
Update the value of **TechnicalProfileReferenceId** to the ID of the technical profile you created earlier. For example, `LinkedIn-OAUTH`.
258-
259-
3. Save the *TrustFrameworkExtensions.xml* file and upload it again for verification.
260-
261-
## Create an Azure AD B2C application
262-
263-
Communication with Azure AD B2c occurs through an application that you create in your tenant. This section lists optional steps you can complete to create a test application if you haven't already done so.
264-
265-
1. Sign in to the [Azure portal](https://portal.azure.com).
266-
2. Make sure you're using the directory that contains your Azure AD B2C tenant. Select the **Directory and subscription filter** in the top menu and choose the directory that contains your tenant.
267-
3. Choose **All services** in the top-left corner of the Azure portal, and then search for and select **Azure AD B2C**.
268-
4. Select **Applications**, and then select **Add**.
269-
5. Enter a name for the application, for example *testapp1*.
270-
6. For **Web App / Web API**, select `Yes`, and then enter `https://jwt.ms` for the **Reply URL**.
271-
7. Click **Create**.
272-
273-
## Update and test the relying party file
274-
275-
Update the relying party (RP) file that initiates the user journey that you created.
276-
277-
1. Make a copy of *SignUpOrSignIn.xml* in your working directory, and rename it. For example, rename it to *SignUpSignInLinkedIn.xml*.
278-
2. Open the new file and update the value of the **PolicyId** attribute for **TrustFrameworkPolicy** with a unique value. For example, `SignUpSignInLinkedIn`.
279-
3. Update the value of **PublicPolicyUri** with the URI for the policy. For example,`http://contoso.com/B2C_1A_signup_signin_linkedin`
280-
4. Update the value of the **ReferenceId** attribute in **DefaultUserJourney** to match the ID of the new user journey that you created (SignUpSignLinkedIn).
281-
5. Save your changes, upload the file, and then select the new policy in the list.
282-
6. Make sure that Azure AD B2C application that you created is selected in the **Select application** field, and then test it by clicking **Run now**.
283-
284-
285224
## Migration from v1.0 to v2.0
286225

287226
LinkedIn recently [updated their API's from v1.0 to v2.0](https://engineering.linkedin.com/blog/2018/12/developer-program-updates). To migrate your existing configuration to the new configuration, use the information in the following sections to update the elements in the technical profile.
@@ -381,14 +320,56 @@ The **BuildingBlocks** element should be added near the top of the file. See the
381320

382321
### Obtain an email address
383322

384-
As part of the LinkedIn migration from v1.0 to v2.0, an extra call to another API is required to obtain the email address. If you need to obtain the email address during sign-up, do the following:
323+
As part of the LinkedIn migration from v1.0 to v2.0, an additional call to another API is required to obtain the email address. If you need to obtain the email address during sign-up, do the following:
385324

386-
1. Have Azure AD B2C federate with LinkedIn to let the user sign in. When this happens, the access token is sent from LinkedIn to Azure AD B2C.
325+
1. Complete the steps above to allow Azure AD B2C to federate with LinkedIn to let the user sign in. As part of the federation, Azure AD B2C receives the access token for LinkedIn.
387326
2. Save the LinkedIn access token into a claim. [See the instructions here](idp-pass-through-custom.md).
388-
3. Call an Azure Function and pass the function the access token collected in the previous step. [See the instructions here](active-directory-b2c-rest-api-step-custom.md)
389-
1. The Azure function should take the access token and make a call to the LinkedIn API (`https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))`).
390-
2. The Azure function takes the response and parses out the email address.
391-
3. The email address is returned back to the policy.
392-
4. The email address is stored in the email claim and the user journey continues on.
327+
3. Add the following claims provider that makes the request to LinkedIn's `/emailAddress` API. In order to authorize this request, you need the LinkedIn access token.
328+
329+
```XML
330+
<ClaimsProvider>
331+
<DisplayName>REST APIs</DisplayName>
332+
<TechnicalProfiles>
333+
<TechnicalProfile Id="API-LinkedInEmail">
334+
<DisplayName>Get LinkedIn email</DisplayName>
335+
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
336+
<Metadata>
337+
<Item Key="ServiceUrl">https://api.linkedin.com/v2/emailAddress?q=members&amp;projection=(elements*(handle~))</Item>
338+
<Item Key="AuthenticationType">Bearer</Item>
339+
<Item Key="UseClaimAsBearerToken">identityProviderAccessToken</Item>
340+
<Item Key="SendClaimsIn">Url</Item>
341+
<Item Key="ResolveJsonPathsInJsonTokens">true</Item>
342+
</Metadata>
343+
<InputClaims>
344+
<InputClaim ClaimTypeReferenceId="identityProviderAccessToken" />
345+
</InputClaims>
346+
<OutputClaims>
347+
<OutputClaim ClaimTypeReferenceId="email" PartnerClaimType="elements[0].handle~.emailAddress" />
348+
</OutputClaims>
349+
<UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop" />
350+
</TechnicalProfile>
351+
</TechnicalProfiles>
352+
</ClaimsProvider>
353+
```
354+
355+
4. Add the following orchestration step into your user journey, so that the API claims provider is triggered when a user signs in using LinkedIn. Make sure to update the `Order` number appropriately. Add this step immediately after the orchestration step that triggers the LinkedIn technical profile.
356+
357+
```XML
358+
<!-- Extra step for LinkedIn to get the email -->
359+
<OrchestrationStep Order="4" Type="ClaimsExchange">
360+
<Preconditions>
361+
<Precondition Type="ClaimEquals" ExecuteActionsIf="false">
362+
<Value>identityProvider</Value>
363+
<Value>linkedin.com</Value>
364+
<Action>SkipThisOrchestrationStep</Action>
365+
</Precondition>
366+
</Preconditions>
367+
<ClaimsExchanges>
368+
<ClaimsExchange Id="GetEmail" TechnicalProfileReferenceId="API-LinkedInEmail" />
369+
</ClaimsExchanges>
370+
</OrchestrationStep>
371+
```
372+
373+
Obtaining the email address from LinkedIn during sign-up is optional. If you choose not to obtain the email from LinkedIn but require one during sign up, the user is required to manually enter the email address and validate it.
393374

394-
Obtaining the email address from LinkedIn during sign-up is optional. If you choose not to obtain the email, the user is required to manually enter the email address and validate it.
375+
For a full sample of a policy that uses the LinkedIn identity provider, see the [Custom Policy Starter Pack](https://github.com/Azure-Samples/active-directory-b2c-custom-policy-starterpack/tree/master/scenarios/linkedin-identity-provider).

0 commit comments

Comments
 (0)