Beispiel #1
0
        public async Task <ActionResult <ApiKeyData> > RevokeKey()
        {
            ControllerContext.HttpContext.GetAPIKey(out var apiKey);
            await _apiKeyRepository.Remove(apiKey, _userManager.GetUserId(User));

            return(Ok());
        }
Beispiel #2
0
 public async Task <IActionResult> RevokeKey(string apikey)
 {
     if (!string.IsNullOrEmpty(apikey) &&
         await _apiKeyRepository.Remove(apikey, _userManager.GetUserId(User)))
     {
         return(Ok());
     }
     else
     {
         return(this.CreateAPIError("apikey-not-found", "This apikey does not exists"));
     }
 }
Beispiel #3
0
 public async Task <IActionResult> RevokeKey(string apikey)
 {
     if (string.IsNullOrEmpty(apikey))
     {
         return(NotFound());
     }
     if (await _apiKeyRepository.Remove(apikey, _userManager.GetUserId(User)))
     {
         return(Ok());
     }
     else
     {
         return(NotFound());
     }
 }