protected async override Task<HttpResponseMessage> SendAsync(
                                        HttpRequestMessage request, CancellationToken cancellationToken)
        {
            try
            {
                HawkServer server = new HawkServer(request, credentialsCallback, verificationCallback);

                var principal = await server.AuthenticateAsync();

                if (principal != null)
                {
                    Thread.CurrentPrincipal = principal;

                    if (HttpContext.Current != null)
                        HttpContext.Current.User = principal;
                }

                var response = await base.SendAsync(request, cancellationToken);

                await server.CreateServerAuthorizationAsync(response, this.normalizationCallback);

                return response;
            }
            catch (Exception)
            {
                var response = request.CreateResponse(HttpStatusCode.Unauthorized);
                response.Headers.WwwAuthenticate.Add(new AuthenticationHeaderValue(HawkConstants.Scheme));

                return response;
            }
        }
        protected async override Task<HttpResponseMessage> SendAsync(
                                        HttpRequestMessage request, CancellationToken cancellationToken)
        {
            Tracing.Start("HawkAuthenticationHandler");

            try
            {
                HawkServer server = new HawkServer(new WebApiRequestMessage(request), options);

                var principal = await server.AuthenticateAsync();

                if (principal != null && principal.Identity.IsAuthenticated)
                {
                    Thread.CurrentPrincipal = principal;

                    if (HttpContext.Current != null)
                        HttpContext.Current.User = principal;

                    Tracing.Verbose("Authentication Successful and principal set for " + principal.Identity.Name);
                }

                var response = await base.SendAsync(request, cancellationToken);

                var header = await server.CreateServerAuthorizationAsync(new WebApiResponseMessage(response));
                if (header != null)
                    response.Headers.Add(header.Item1, header.Item2);

                return response;
            }
            catch (Exception ex)
            {
                Tracing.Error("Exception: " + ex.ToString());

                var response = request.CreateResponse(HttpStatusCode.Unauthorized);
                response.Headers.WwwAuthenticate.Add(new AuthenticationHeaderValue(HawkConstants.Scheme));

                return response;
            }
        }