public async Task <IActionResult> Delete(string clientId, CancellationToken cancellationToken) { try { var jObjHeader = Request.Headers.ToJObject(); var context = new HandlerContext(new HandlerContextRequest(Request.GetAbsoluteUriWithVirtualPath(), null, null, jObjHeader)); await _deleteOAuthClientHandler.Handle(clientId, context, cancellationToken); return(new NoContentResult()); } catch (OAuthUnauthorizedException ex) { var res = new JObject { { ErrorResponseParameters.Error, ex.Code }, { ErrorResponseParameters.ErrorDescription, ex.Message } }; return(new ContentResult { Content = res.ToString(), ContentType = "application/json", StatusCode = (int)HttpStatusCode.Unauthorized }); } }
public virtual async Task <IActionResult> DeleteClient(string id, CancellationToken cancellationToken) { try { await _deleteOAuthClientHandler.Handle(id, cancellationToken); return(new NoContentResult()); } catch (OAuthClientNotFoundException) { return(new NotFoundResult()); } }