Last active
December 31, 2015 06:49
-
-
Save christopherhouse/7949670 to your computer and use it in GitHub Desktop.
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
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