Commit d0f3d8d
authored
WSL reports as Linux but has no msalruntime daemon, causing
MsalSilentTokenProvider to fail when using appInteractiveBroker.
- Add PlatformInformation.IsWSL() to detect WSL via
RuntimeInformation.IsOSPlatform(Linux) and WSL_DISTRO_NAME env var
- Use non-broker app for silent auth on WSL, matching behavior before
0cddac6
- Add tests for WSL and non-WSL silent auth provider selection
### Problem
Commit #664 (#666) changed `MsalSilentTokenProvidert`o use
`appInteractiveBroker ?? app` so that the broker's token cache is
queried on silent auth. This works correctly on Windows and macOS, but
breaks Windows Subsystem for Linux (WSL) due to stdout corruption from
MSAL linux broker subprocesses.
Related MSAL issue:
AzureAD/microsoft-authentication-library-for-dotnet#5979
### work around until MSAL responds
Add `PlatformInformation.IsWSL()` which returns true when the runtime OS
is Linux and the WSL_DISTRO_NAME environment variable is set (always
present in WSL sessions, never set on native Linux/macOS/Windows). In
`MsalTokenProviders.Get()` use the non-broker app for silent auth when
running in WSL, restoring the pre-#664 behavior for WSL users while
keeping broker-accelerated silent auth on Windows and macOS.
### Testing
Added unit tests covering silent provider selection under WSL and
non-WSL conditions with both empty and warm MSAL caches.
1 parent 7f144f1 commit d0f3d8d
3 files changed
Lines changed: 59 additions & 3 deletions
File tree
- src
- Authentication.Tests
- Authentication
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
181 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
182 | 188 | | |
183 | 189 | | |
184 | 190 | | |
| |||
207 | 213 | | |
208 | 214 | | |
209 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
210 | 253 | | |
211 | 254 | | |
212 | 255 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
82 | 92 | | |
0 commit comments