Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.

Commit 48462d8

Browse files
committed
Workaround ADAL 3.x bug by catching all exceptions
Due to a bug in ADAL 3.x an `HttpRequestException` can leak instead of being a `AdalException`. AzureAD/azure-activedirectory-library-for-dotnet#1285 ADAL 3.x is not going to patched for this as ADAL 4.x and MSAL do not have this problem. We can revisit this if we upgrade ADAL->4 or ->MSAL.
1 parent 2117f51 commit 48462d8

File tree

1 file changed

+8
-2
lines changed
  • AzureDevOps.Authentication/Src

1 file changed

+8
-2
lines changed

AzureDevOps.Authentication/Src/Adal.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ public async Task<IAdalResult> AcquireTokenAsync(
134134

135135
return new Result(result);
136136
}
137-
catch (ActiveDirectory.AdalException exception)
137+
// We should just be able to catch AdalException here but due to an ADAL bug an HttpRequestException can be leaked:
138+
// https://github.com/AzureAD/azure-activedirectory-library-for-dotnet/issues/1285
139+
// Until we update to ADAL 4.x or MSAL, we should just workaround this problem.
140+
catch (Exception exception)
138141
{
139142
throw new AuthenticationException(exception);
140143
}
@@ -164,7 +167,10 @@ public async Task<IAdalResult> AcquireTokenAsync(
164167

165168
return new Result(result);
166169
}
167-
catch (ActiveDirectory.AdalException exception)
170+
// We should just be able to catch AdalException here but due to an ADAL bug an HttpRequestException can be leaked:
171+
// https://github.com/AzureAD/azure-activedirectory-library-for-dotnet/issues/1285
172+
// Until we update to ADAL 4.x or MSAL, we should just workaround this problem.
173+
catch (Exception exception)
168174
{
169175
throw new AuthenticationException(exception);
170176
}

0 commit comments

Comments
 (0)