protected override async Task <AuthenticationTicket> AuthenticateCoreAsync() { var apiKey = Request.Headers[TheOptions.ApiKeyHeaderName]; if (!string.IsNullOrEmpty(apiKey)) { // Get the user var authUser = await Auth.Authenticate(CredentialBuilder.ParseApiKeyCredential(apiKey)); if (authUser != null) { // Set the current user Context.Set(Constants.CurrentUserOwinEnvironmentKey, authUser); return(new AuthenticationTicket( AuthenticationService.CreateIdentity( authUser.User, AuthenticationTypes.ApiKey, new Claim(NuGetClaims.ApiKey, apiKey)), new AuthenticationProperties())); } else { // No user was matched Logger.WriteWarning("No match for API Key!"); } } else { Logger.WriteVerbose("No API Key Header found in request."); } return(null); }