Skip to content

Commit 06c929e

Browse files
committed
fix: misc spelling issues and enhance user sign-in experience section with video demonstration
1 parent ed5ebe6 commit 06c929e

2 files changed

Lines changed: 29 additions & 45 deletions

File tree

msal-dotnet-articles/acquiring-tokens/desktop-mobile/linux-dotnet-sdk-wsl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Using MSAL.Net with Wiindows Subsystem for Linux
2+
title: Using MSAL.Net with Windows Subsystem for Linux
33
description: Learn how to integrate Microsoft Entra ID authentication in WSL apps using MSAL.NET and the Microsoft Single Sign-on for Linux broker.
44
author: ploegert
55
ms.author: jploegert

msal-dotnet-articles/acquiring-tokens/desktop-mobile/linux-dotnet-sdk.md

Lines changed: 28 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,33 @@ An authentication broker is an application that runs on a user’s machine that
2929
- **System integration.** Applications that use the broker plug-and-play with the built-in account picker, allowing the user to quickly pick an existing account instead of reentering the same credentials over and over.
3030
- **Token Protection.** Microsoft single sign-on for Linux ensures that the refresh tokens are device bound and [enables apps](../../advanced/proof-of-possession-tokens.md) to acquire device bound access tokens. See [Token Protection](/azure/active-directory/conditional-access/concept-token-protection).
3131

32-
## Prerequisites
32+
## User sign-in experience
33+
34+
This video demonstrates the sign-in experience on brokered flows on Linux
35+
36+
![Demo of the Linux Login component component](../../media/linux/linux-entra-login.gif)
37+
38+
## How to opt in to use broker?
39+
40+
### Update Application Definition
41+
42+
In the MSAL Python library, we've introduced the `enable_broker_on_linux` flag, which enables the broker on both WSL and standalone Linux.
43+
- If your goal is to enable broker support solely on WSL for Azure CLI, you can consider modifying the Azure CLI app code to activate the `enable_broker_on_wsl` flag exclusively on WSL.
44+
- If you are writing a cross-platform application, you'll also need to use `enable_broker_on_windows`, as outlined in the [Using MSAL Python with Web Account Manager](wam.md) article.
45+
- You can set any combination of the following opt-in parameters to true:
46+
47+
| Opt-in flag | If app runs on | App has registered this as a Desktop platform redirect URI in Azure portal |
48+
| ------------------------ | --------------------------------- | -------------------------------------------------------------------------------- |
49+
| enable_broker_on_windows | Windows 10+ | ms-appx-web://Microsoft.AAD.BrokerPlugin/your_client_id |
50+
| enable_broker_on_wsl | WSL | ms-appx-web://Microsoft.AAD.BrokerPlugin/your_client_id |
51+
| enable_broker_on_mac | Mac with Company Portal installed | msauth.com.msauth.unsignedapp://auth |
52+
| enable_broker_on_linux | Linux with Intune installed | `https://login.microsoftonline.com/common/oauth2/nativeclient` (MUST be enabled) |
53+
54+
Your application needs to support broker-specific redirect URIs. For `Linux` specifically, the URL for the redirect URI must be:
55+
56+
```text
57+
https://login.microsoftonline.com/common/oauth2/nativeclient
58+
```
3359

3460
### .NET Installation
3561

@@ -70,9 +96,7 @@ sudo dnf install libx11-6 libc++1 libc++abi1 libsecret-1-0 libwebkit2gtk-4.0-37
7096

7197
To use the broker, apps must provide the window handle to which the modal dialog be parented using `libx11` library. The window handle must be provided by the developer because it's infeasible for MSAL itself to infer the parent window. In the past, lack of handling parent window leads to bad user experiences where the authentication window was hidden behind the application window.
7298

73-
For console applications, you can use code like the snippet below.
74-
75-
Here’s sample code to use `libx11`:
99+
For console applications, here’s sample code to use `libx11`:
76100

77101
```csharp
78102
using System;
@@ -107,40 +131,6 @@ To set up a test app, you can either create your own console app as shown below,
107131

108132
To use a broker on the Linux platform, set the `BrokerOptions` to `OperatingSystems.Linux` as shown in the below code snippet:
109133

110-
```csharp
111-
using Microsoft.Identity.Client;
112-
using Microsoft.Identity.Client.Broker;
113-
114-
from msal import PublicClientApplication
115-
116-
class Program
117-
{
118-
public static string ClientID = "your client id"; //msidentity-samples-testing tenant
119-
public static string[] Scopes = { "User.Read" };
120-
static void Main(string[] args)
121-
{
122-
Console.WriteLine("Hello World!");
123-
124-
var pcaBuilder = PublicClientApplicationBuilder.Create(ClientID)
125-
.WithAuthority("https://login.microsoftonline.com/common")
126-
.WithDefaultRedirectUri()
127-
.WithBroker(new BrokerOptions(BrokerOptions.OperatingSystems.Linux){
128-
ListOperatingSystemAccounts = true,
129-
MsaPassthrough = true,
130-
Title = "MSAL WSL Test App"
131-
})
132-
.Build();
133-
134-
AcquireTokenInteractiveParameterBuilder atparamBuilder = pcaBuilder.AcquireTokenInteractive(Scopes);
135-
136-
AuthenticationResult authenticationResult = atparamBuilder.ExecuteAsync().GetAwaiter().GetResult();
137-
System.Console.WriteLine(authenticationResult.AccessToken);
138-
}
139-
}
140-
```
141-
142-
## Sample App
143-
144134
A sample application is available in the [MSAL.NET GitHub repository](https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/tree/main/tests/devapps/WAM/NetWSLWam).
145135

146136
```csharp
@@ -257,12 +247,6 @@ To run the sample app:
257247
dotnet run --project tests/devapps/WAM/NetWSLWam/test.csproj
258248
```
259249

260-
## Demo of user Login
261-
262-
This video demonstrates the sign-in experience on brokered flows on Linux
263-
264-
![Demo of the Linux Login component component](../../media/linux/linux-entra-login.gif)
265-
266250
## Username/password flow
267251

268252
This flow, also known as Resource Owner Password Credentials (ROPC), isn't recommended except in test scenarios or in scenarios where service principal access to a resource gives it too much access and you can only scope it down with user flows. When using the broker, [`AcquireTokenByUsernamePassword`](xref:Microsoft.Identity.Client.PublicClientApplication.AcquireTokenByUsernamePassword*) lets the broker manage the protocol and fetch tokens.

0 commit comments

Comments
 (0)