code: public String getScopes(HttpRequest req) throws OAuthException {
          QueryStringDecoder dec = new QueryStringDecoder(req.uri());
          Map<String, List<String>> queryParams = dec.parameters();
          if (queryParams.containsKey("client_id")) {
              return getScopes(queryParams.get("client_id").get(0));
          }
          List<Scope> scopes = DBManagerFactory.getInstance().getAllScopes().blockingGet();
          String jsonString;
          try {
              jsonString = JSON.toJSONString(scopes);
          } catch (Exception e) {
              LOG.error("cannot load scopes", e);
              throw new OAuthException(e, null, HttpResponseStatus.BAD_REQUEST);
          }
          return jsonString;
      }
docs: Returns either all scopes or scopes for a specific client_id passed as query parameter.
  
  @param req request
  @return string If query param client_id is passed, then the scopes for that client_id will be returned.
  Otherwise, all available scopes will be returned in JSON format.