docs: private static EsToken obtainEsToken(final RestClient client, User user) {
          // TODO: Should we extend this to basic authentication at some point?
          KerberosPrincipal principal = user.getKerberosPrincipal();
          if (user.isProxyUser()) {
              principal = user.getRealUserProvider().getUser().getKerberosPrincipal();
          }
          Assert.isTrue(principal != null, "Kerberos credentials are missing on current user");
          return user.doAs(new PrivilegedExceptionAction<EsToken>() {
              @Override
              public EsToken run() {
                  return client.createNewApiToken(newKeyName());
              }
          });
      }