Skip to content

Commit ac4d350

Browse files
committed
Merge branch 'master' of https://github.com/MicrosoftDocs/azure-docs-pr into metadataupdatesept18
2 parents ac0410f + a8abb30 commit ac4d350

File tree

91 files changed

+1107
-404
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1107
-404
lines changed

articles/active-directory/develop/msal-net-migration-ios-broker.md

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Migrating Xamarin iOS applications using Microsoft Authenticator from ADAL.NET to MSAL.NET | Azure
3-
description: Learn how to migrate Xamarin iOS applications using Microsoft Authenticator from the Azure AD Authentication Library for .NET (ADAL.NET) to the Microsoft Authentication Library for .NET (MSAL.NET)
2+
title: Migrate Xamarin iOS applications that use Microsoft Authenticator from ADAL.NET to MSAL.NET | Azure
3+
description: Learn how to migrate Xamarin iOS applications that use Microsoft Authenticator from the Azure AD Authentication Library for .NET (ADAL.NET) to the Microsoft Authentication Library for .NET (MSAL.NET).
44
documentationcenter: dev-center-name
55
author: jmprieur
66
manager: CelesteDG
@@ -16,30 +16,30 @@ ms.date: 09/08/2019
1616
ms.author: jmprieur
1717
ms.reviewer: saeeda
1818
ms.custom: aaddev
19-
#Customer intent: As an application developer, I want to learn how to migrate my iOS applications using Microsoft Authenticator from ADAL.NET to MSAL.NET
19+
#Customer intent: As an application developer, I want to learn how to migrate my iOS applications that use Microsoft Authenticator from ADAL.NET to MSAL.NET.
2020
ms.collection: M365-identity-device-management
2121
---
2222

23-
# Migrating iOS applications using Microsoft Authenticator from ADAL.NET to MSAL.NET
23+
# Migrate iOS applications that use Microsoft Authenticator from ADAL.NET to MSAL.NET
2424

25-
You've been using ADAL.NET and the iOS broker, and it's time to migrate to MSAL.NET [Microsoft authentication library](msal-overview.md),which, supports the broker on iOS from release 4.3 onwards.
25+
You've been using the Azure Active Directory Authentication Library for .NET (ADAL.NET) and the iOS broker. Now it's time to migrate to the [Microsoft Authentication Library](msal-overview.md) for .NET (MSAL.NET), which supports the broker on iOS from release 4.3 onward.
2626

27-
Where to start? This article will help you migrate your Xamarin iOS app from ADAL to MSAL.
27+
Where should you start? This article helps you migrate your Xamarin iOS app from ADAL to MSAL.
2828

2929
## Prerequisites
30-
This document assumes that you already have a Xamarin iOS app that is integrated with the iOS broker. If you don't, it would be best to move directly to MSAL.NET and begin the broker implementation there. See [this documentation](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/Leveraging-the-broker-on-iOS#why-use-brokers-on-xamarinios-and-xamarinandroid-applications) for details on invoking the iOS broker in MSAL.NET with a new application.
30+
This article assumes that you already have a Xamarin iOS app that's integrated with the iOS broker. If you don't, move directly to MSAL.NET and begin the broker implementation there. For information on how to invoke the iOS broker in MSAL.NET with a new application, see [this documentation](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/Leveraging-the-broker-on-iOS#why-use-brokers-on-xamarinios-and-xamarinandroid-applications).
3131

3232
## Background
3333

3434
### What are brokers?
3535

36-
Brokers are applications, provided by Microsoft, on Android and iOS ([Microsoft Authenticator](https://www.microsoft.com/en-us/account/authenticator) on iOS and Android, Intune Company Portal on Android).
36+
Brokers are applications provided by Microsoft on Android and iOS. (See the [Microsoft Authenticator](https://www.microsoft.com/account/authenticator) app on iOS and Android, and the Intune Company Portal app on Android.)
3737

3838
They enable:
3939

40-
- Single-Sign-On,
41-
- Device identification, which is required by some [conditional access policies](../conditional-access/overview.md) (See [Device management](../conditional-access/conditions.md#device-platforms))
42-
- Application identification verification, also required in some enterprise scenarios (See for instance [Intune mobile application management, or MAM](https://docs.microsoft.com/intune/mam-faq))
40+
- Single sign-on.
41+
- Device identification, which is required by some [conditional access policies](../conditional-access/overview.md). For more information, see [Device management](../conditional-access/conditions.md#device-platforms).
42+
- Application identification verification, which is also required in some enterprise scenarios. For more information, see [Intune mobile application management (MAM)](https://docs.microsoft.com/intune/mam-faq).
4343

4444
## Migrate from ADAL to MSAL
4545

@@ -48,7 +48,9 @@ They enable:
4848
<table>
4949
<tr><td>Current ADAL code:</td><td>MSAL counterpart:</td></tr>
5050
<tr><td>
51-
In ADAL.NET, broker support was enabled on a per-authentication context basis, it's disabled by default. You had to set a `useBroker` flag to true in the `PlatformParameters` constructor to call broker:
51+
In ADAL.NET, broker support was enabled on a per-authentication context basis. It's disabled by default. You had to set a
52+
53+
`useBroker` flag to true in the `PlatformParameters` constructor to call the broker:
5254

5355
```CSharp
5456
public PlatformParameters(
@@ -78,10 +80,10 @@ Then, include the parameters in the acquire token call:
7880
```
7981

8082
</td><td>
81-
In MSAL.NET, broker support is enabled on a per-Public Client Application basis. It is disabled by default. To enable it, use:
83+
In MSAL.NET, broker support is enabled on a per-PublicClientApplication basis. It's disabled by default. To enable it, use the
8284

8385
`WithBroker()`
84-
parameter (set to true by default) in order to call broker:
86+
parameter (set to true by default) in order to call the broker:
8587

8688
```CSharp
8789
var app = PublicClientApplicationBuilder
@@ -90,7 +92,7 @@ var app = PublicClientApplicationBuilder
9092
.WithReplyUri(redirectUriOnIos)
9193
.Build();
9294
```
93-
In the Acquire Token call:
95+
In the acquire token call:
9496
```CSharp
9597
result = await app.AcquireTokenInteractive(scopes)
9698
.WithParentActivityOrWindow(App.RootViewController)
@@ -99,11 +101,13 @@ result = await app.AcquireTokenInteractive(scopes)
99101
</table>
100102

101103
### Step 2: Set a UIViewController()
102-
In ADAL.NET, you passed in the UIViewController as part of the PlatformParameters (see example in Step 1). However, in MSAL.NET, to give the developer more flexibility, an object window is used, but not required in regular iOS usage. However, in order to use the broker, you'll need to set the object window in order to send and receive responses from broker.
104+
In ADAL.NET, you passed in a UIViewController as part of `PlatformParameters`. (See the example in Step 1.) In MSAL.NET, to give developers more flexibility, an object window is used, but it's not required in regular iOS usage. To use the broker, set the object window in order to send and receive responses from the broker.
103105
<table>
104106
<tr><td>Current ADAL code:</td><td>MSAL counterpart:</td></tr>
105107
<tr><td>
106-
The UIViewController is passed into the PlatformParamters in the iOS specific platform.
108+
A UIViewController is passed into
109+
110+
`PlatformParameters` in the iOS-specific platform.
107111

108112
```CSharp
109113
page.BrokerParameters = new PlatformParameters(
@@ -112,14 +116,14 @@ page.BrokerParameters = new PlatformParameters(
112116
PromptBehavior.SelectAccount);
113117
```
114118
</td><td>
115-
In MSAL.NET, you'll need to do two things to set the object window for iOS:
119+
In MSAL.NET, you do two things to set the object window for iOS:
116120

117-
1) In `AppDelegate.cs`, set the `App.RootViewController` to a new `UIViewController()`.
118-
This assignment will ensure that there's a UIViewController with the call to the broker. If it isn't set correctly, you may get this error:
121+
1. In `AppDelegate.cs`, set `App.RootViewController` to a new `UIViewController()`.
122+
This assignment ensures that there's a UIViewController with the call to the broker. If it isn't set correctly, you might get this error:
119123
`"uiviewcontroller_required_for_ios_broker":"UIViewController is null, so MSAL.NET cannot invoke the iOS broker. See https://aka.ms/msal-net-ios-broker"`
120-
2) On the AcquireTokenInteractive call, use the
121-
`.WithParentActivityOrWindow(App.RootViewController)`
122-
and pass in the reference to the object window you'will use.
124+
1. On the AcquireTokenInteractive call, use
125+
`.WithParentActivityOrWindow(App.RootViewController)`,
126+
and pass in the reference to the object window you'll use.
123127

124128
**For example:**
125129

@@ -132,7 +136,7 @@ In `AppDelegate.cs`:
132136
LoadApplication(new App());
133137
App.RootViewController = new UIViewController();
134138
```
135-
In the Acquire Token call:
139+
In the acquire token call:
136140
```CSharp
137141
result = await app.AcquireTokenInteractive(scopes)
138142
.WithParentActivityOrWindow(App.RootViewController)
@@ -142,17 +146,17 @@ result = await app.AcquireTokenInteractive(scopes)
142146
</table>
143147

144148
### Step 3: Update AppDelegate to handle the callback
145-
Both ADAL and MSAL will call the broker, and broker will, in turn, call back to your application through the `OpenUrl` method of the `AppDelegate` class. More information available [here](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/Leveraging-the-broker-on-iOS/_edit#step-two-update-appdelegate-to-handle-the-callback)
149+
Both ADAL and MSAL call the broker, and the broker in turn calls back to your application through the `OpenUrl` method of the `AppDelegate` class. For more information, see [this documentation](msal-net-use-brokers-with-xamarin-apps.md#step-2-update-appdelegate-to-handle-the-callback).
146150

147-
:heavy_check_mark:**There are no changes here between ADAL.NET and MSAL.NET**
151+
There are no changes here between ADAL.NET and MSAL.NET.
148152

149153
### Step 4: Register a URL scheme
150154
ADAL.NET and MSAL.NET use URLs to invoke the broker and return the broker response back to the app. Register the URL scheme in the `Info.plist` file for your app as follows:
151155

152156
<table>
153157
<tr><td>Current ADAL code:</td><td>MSAL counterpart:</td></tr>
154158
<tr><td>
155-
The URL Scheme is unique to your app.
159+
The URL scheme is unique to your app.
156160
</td><td>
157161
The
158162

@@ -184,13 +188,14 @@ For example:
184188
```
185189

186190
> [!NOTE]
187-
> This URL scheme will become part of the RedirectUri used for uniquely identifying the app when receiving the response from broker
191+
> This URL scheme becomes part of the redirect URI that's used to uniquely identify the app when it receives the response from the broker.
188192
189193
</table>
190194

191-
### Step 5: LSApplicationQueriesSchemes
195+
### Step 5: Add the broker identifier to the LSApplicationQueriesSchemes section
196+
197+
ADAL.NET and MSAL.NET both use `-canOpenURL:` to check if the broker is installed on the device. Add the correct identifier for the iOS broker to the LSApplicationQueriesSchemes section of the info.plist file as follows:
192198

193-
ADAL.NET and MSAL.NET both use `-canOpenURL:` to check if the broker is installed on the device. Add the correct identifier for the iOS broker to the LSApplicationQueriesSchemes section of the info.plist file as follows:
194199
<table>
195200
<tr><td>Current ADAL code:</td><td>MSAL counterpart:</td></tr>
196201
<tr><td>
@@ -219,26 +224,29 @@ Uses
219224
```
220225
</table>
221226

222-
### Step 6: Register you RedirectUri in the portal
227+
### Step 6: Register your redirect URI in the portal
223228

224-
ADAL.NET and MSAL.NET both add an extra requirement on the redirectUri when targeting broker. Register the redirect URI with your application in the portal.
229+
ADAL.NET and MSAL.NET both add an extra requirement on the redirect URI when it targets the broker. Register the redirect URI with your application in the portal.
225230
<table>
226231
<tr><td>Current ADAL code:</td><td>MSAL counterpart:</td></tr>
227232
<tr><td>
228233

229234
`"<app-scheme>://<your.bundle.id>"`
230-
example: `mytestiosapp://com.mycompany.myapp`
235+
236+
Example:
237+
238+
`mytestiosapp://com.mycompany.myapp`
231239
</td><td>
232240

233241
`$"msauth.{BundleId}://auth"`
234242

235-
example:
243+
Example:
236244

237245
`public static string redirectUriOnIos = "msauth.com.yourcompany.XForms://auth"; `
238246

239247
</table>
240248

241-
For more information about registering the redirectUri in the portal, see [Leveraging the broker in Xamarin.iOS applications](msal-net-use-brokers-with-xamarin-apps.md#step-7-make-sure-the-redirect-uri-is-registered-with-your-app) for more details.
249+
For more information about how to register the redirect URI in the portal, see [Leverage the broker in Xamarin.iOS applications](msal-net-use-brokers-with-xamarin-apps.md#step-7-make-sure-the-redirect-uri-is-registered-with-your-app).
242250

243251
## Next steps
244252

0 commit comments

Comments
 (0)