code: private static Single<Optional<String>> fetchAccessTokenAndReturnScope(UnitRequest request) {
          LOG.info("fetchAccessTokenAndReturnScope");
          String ip = request.getContext().getIp();
          if (StringUtil.isEmpty(ip)) {
              throw new IllegalArgumentException("Client's ip is empty, please check!");
          }
          if (isWhiteIp(ip)) {
              LOG.info(new JSONObject().fluentPut("type", LogTypeGateway.whiteIp)
                      .fluentPut("description", "request is from white ip " + ip)
                      .fluentPut("ip", ip));
              return Single.just(Optional.of(Scope.api_all));
          }
          String accessToken = request.getContext().getHeader() == null ? null :
                  request.getContext().getHeader().getOrDefault(Constant.XIAN_REQUEST_TOKEN_HEADER, null);
          if (StringUtil.isEmpty(accessToken)) {
              return Single.just(Optional.empty());
          } else {
              return forToken(accessToken).map(optionalAccessToken -> {
                  if (optionalAccessToken.isPresent()) {
                      request.getContext().setAccessToken(optionalAccessToken.get());
                      return Optional.of(optionalAccessToken.get().getScope());
                  } else {
                      return Optional.empty();
                  }
              });
          }
      }
docs: query for access token info and set it into the request context
  and return the scope of current token.
  
  @return the scope of the request or empty
  if no token string is provided.