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/develop/msal-net-migration-ios-broker.md
+43-35Lines changed: 43 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
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).
4
4
documentationcenter: dev-center-name
5
5
author: jmprieur
6
6
manager: CelesteDG
@@ -16,30 +16,30 @@ ms.date: 09/08/2019
16
16
ms.author: jmprieur
17
17
ms.reviewer: saeeda
18
18
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.
20
20
ms.collection: M365-identity-device-management
21
21
---
22
22
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
24
24
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.
26
26
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.
28
28
29
29
## 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).
31
31
32
32
## Background
33
33
34
34
### What are brokers?
35
35
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.)
37
37
38
38
They enable:
39
39
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).
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:
52
54
53
55
```CSharp
54
56
publicPlatformParameters(
@@ -78,10 +80,10 @@ Then, include the parameters in the acquire token call:
78
80
```
79
81
80
82
</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
82
84
83
85
`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:
85
87
86
88
```CSharp
87
89
varapp=PublicClientApplicationBuilder
@@ -90,7 +92,7 @@ var app = PublicClientApplicationBuilder
@@ -99,11 +101,13 @@ result = await app.AcquireTokenInteractive(scopes)
99
101
</table>
100
102
101
103
### 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.
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.
107
111
108
112
```CSharp
109
113
page.BrokerParameters=newPlatformParameters(
@@ -112,14 +116,14 @@ page.BrokerParameters = new PlatformParameters(
112
116
PromptBehavior.SelectAccount);
113
117
```
114
118
</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:
116
120
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:
119
123
`"uiviewcontroller_required_for_ios_broker":"UIViewController is null, so MSAL.NET cannot invoke the iOS broker. See https://aka.ms/msal-net-ios-broker"`
@@ -142,17 +146,17 @@ result = await app.AcquireTokenInteractive(scopes)
142
146
</table>
143
147
144
148
### 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).
146
150
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.
148
152
149
153
### Step 4: Register a URL scheme
150
154
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:
> 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.
188
192
189
193
</table>
190
194
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:
192
198
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:
### Step 6: Register you RedirectUri in the portal
227
+
### Step 6: Register your redirect URI in the portal
223
228
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.
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).
0 commit comments