private String saveConfInPath(Path confPath, String confName, byte[] confValues) {
      String confFile = getConfPath(confPath, confName);
      synchronized (lock) {
        if (!Paths.get(confFile).toFile().exists()) {
          try (FileOutputStream fileOutputStream = new FileOutputStream(confFile)) {
            ByteStreams.copy(new ByteArrayInputStream(confValues), fileOutputStream);
            LOG.info("Saved the configuration file to path {}.", confFile);
          } catch (IOException e) {
            throw new UncheckedIOException("Fail to save conf files in work space", e);
          }
        } else {
          LOG.info("Configuration file already exists in {}.", confFile);
        }
      }
      return confFile;
    }
Login with configured catalog user and create a proxy user ugi. Then the operations are
performed within the doAs method of this proxy user ugi.
amoro-common/src/main/java/org/apache/amoro/table/TableMetaStore.java