-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add retry for specific codes in managed identity (#4078)
* Add retry for specific codes in managed identity * Refactor http manager and tests * Mege conflict * Send back IsRetryable to true * Address comments * Address comments * Update src/client/Microsoft.Identity.Client/MsalException.cs Co-authored-by: Peter M <34331512+pmaytak@users.noreply.github.com> * Update src/client/Microsoft.Identity.Client/Http/HttpManagerManagedIdentity.cs Co-authored-by: Peter M <34331512+pmaytak@users.noreply.github.com> * Fix test * Update tests --------- Co-authored-by: Gladwin Johnson <90415114+gladjohn@users.noreply.github.com> Co-authored-by: Peter M <34331512+pmaytak@users.noreply.github.com>
- Loading branch information
1 parent
c3b7ba0
commit 90d6daf
Showing
30 changed files
with
550 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/client/Microsoft.Identity.Client/AppConfig/MsalClientType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Microsoft.Identity.Client.AppConfig | ||
{ | ||
/// <summary> | ||
/// Enum to represent the type of MSAL application. | ||
/// </summary> | ||
internal enum MsalClientType | ||
{ | ||
ConfidentialClient, | ||
PublicClient, | ||
ManagedIdentityClient | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/client/Microsoft.Identity.Client/Http/HttpManagerFactory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Microsoft.Identity.Client.Http | ||
{ | ||
/// <summary> | ||
/// Factory to return the instance of HttpManager based on retry configuration and type of MSAL application. | ||
/// </summary> | ||
internal sealed class HttpManagerFactory | ||
{ | ||
public static IHttpManager GetHttpManager(IMsalHttpClientFactory httpClientFactory, bool withRetry, bool isManagedIdentity) | ||
{ | ||
if (!withRetry) | ||
{ | ||
return new HttpManager(httpClientFactory); | ||
} | ||
|
||
return isManagedIdentity ? | ||
new HttpManagerManagedIdentity(httpClientFactory) : | ||
new HttpManagerWithRetry(httpClientFactory); | ||
} | ||
} | ||
} |
Oops, something went wrong.