Skip to content

Instantly share code, notes, and snippets.

@christopherhouse
Last active December 31, 2015 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christopherhouse/7949670 to your computer and use it in GitHub Desktop.
Save christopherhouse/7949670 to your computer and use it in GitHub Desktop.
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using ThirteenDaysAWeek.AzureCustomAuth.Services;
namespace ThirteenDaysAWeek.AzureCustomAuth.Handlers
{
public class ZumoAuthHeaderHandler : DelegatingHandler
{
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
if (string.IsNullOrWhiteSpace(AccountService.AuthenticationToken))
{
throw new InvalidOperationException("User is not currently logged in");
}
request.Headers.Add("X-ZUMO-AUTH", AccountService.AuthenticationToken);
return base.SendAsync(request, cancellationToken);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment