Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (23 sloc) 1.07 KB
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Graph;
using System.Threading;
namespace BTJ.CSAdvent.AZFunc
// This class allows an implementation of IAuthenticationProvider to be inserted into the DelegatingHandler
// pipeline of an HttpClient instance. In future versions of GraphSDK, many cross-cutting concerns will
// be implemented as DelegatingHandlers. This AuthHandler will come in the box.
public class AuthHandler : DelegatingHandler {
private IAuthenticationProvider _authenticationProvider;
public AuthHandler(IAuthenticationProvider authenticationProvider, HttpMessageHandler innerHandler)
InnerHandler = innerHandler;
_authenticationProvider = authenticationProvider;
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
await _authenticationProvider.AuthenticateRequestAsync(request);
return await base.SendAsync(request,cancellationToken);
You can’t perform that action at this time.