private Response handleBasicAuthFailure() throws OAuthSystemException {
   OAuthResponse response =
       OAuthASResponse.errorResponse(HttpServletResponse.SC_UNAUTHORIZED)
           .setError(OAuth2ErrorCodes.INVALID_CLIENT)
           .setErrorDescription("Client Authentication failed.")
           .buildJSONMessage();
   return Response.status(response.getResponseStatus())
       .header(OAuthConstants.HTTP_RESP_HEADER_AUTHENTICATE, EndpointUtil.getRealmInfo())
       .entity(response.getBody())
       .build();
 }
  private Response handleSQLError() throws OAuthSystemException {
    OAuthResponse response =
        OAuthASResponse.errorResponse(HttpServletResponse.SC_BAD_GATEWAY)
            .setError(OAuth2ErrorCodes.SERVER_ERROR)
            .setErrorDescription("Service Unavailable Error.")
            .buildJSONMessage();

    return Response.status(response.getResponseStatus())
        .header(OAuthConstants.HTTP_RESP_HEADER_AUTHENTICATE, EndpointUtil.getRealmInfo())
        .entity(response.getBody())
        .build();
  }