-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'add-retry-handler-to-authentication-providers' of https…
…://github.com/SherpasGroup/pnpcore into pr656
- Loading branch information
Showing
11 changed files
with
138 additions
and
23 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
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
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
20 changes: 20 additions & 0 deletions
20
src/sdk/PnP.Core.Auth/Services/Http/MsalHttpClientFactory.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,20 @@ | ||
using Microsoft.Identity.Client; | ||
using PnP.Core.Services; | ||
using System.Net.Http; | ||
|
||
namespace PnP.Core.Auth.Services.Http | ||
{ | ||
public class MsalHttpClientFactory : IMsalHttpClientFactory | ||
{ | ||
private IHttpClientFactory _httpClientFactory; | ||
|
||
public MsalHttpClientFactory(IHttpClientFactory httpClientFactory) | ||
{ | ||
_httpClientFactory = httpClientFactory; | ||
} | ||
public HttpClient GetHttpClient() | ||
{ | ||
return _httpClientFactory.CreateClient("MsalHttpClient"); | ||
} | ||
} | ||
} |
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,31 @@ | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Options; | ||
using PnP.Core.Services; | ||
|
||
namespace PnP.Core.Auth.Services.Http | ||
{ | ||
/// <summary> | ||
/// Retry handler for Microsoft Graph requests | ||
/// </summary> | ||
internal sealed class MsalRetryHandler : RetryHandlerBase | ||
{ | ||
#region Construction | ||
public MsalRetryHandler(ILogger<RetryHandlerBase> log, IOptions<PnPGlobalSettingsOptions> globalSettings) : base(log, globalSettings?.Value) | ||
{ | ||
Configure(); | ||
} | ||
#endregion | ||
|
||
private void Configure() | ||
{ | ||
if (GlobalSettings != null) | ||
{ | ||
UseRetryAfterHeader = GlobalSettings.HttpMsalUseRetryAfterHeader; | ||
MaxRetries = GlobalSettings.HttpMsalMaxRetries; | ||
DelayInSeconds = GlobalSettings.HttpMsalDelayInSeconds; | ||
IncrementalDelay = GlobalSettings.HttpMsalUseIncrementalDelay; | ||
} | ||
} | ||
|
||
} | ||
} |
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