code: @Override
    public synchronized UserGroupInformation getProxiedUser(final String userToProxy)
        throws HadoopSecurityManagerException {
  
      if (userToProxy == null) {
        throw new HadoopSecurityManagerException("userToProxy can't be null");
      }
  
      UserGroupInformation ugi = this.userUgiMap.get(userToProxy);
      if (ugi == null) {
        logger.info("proxy user " + userToProxy
            + " not exist. Creating new proxy user");
        if (this.shouldProxy) {
          try {
            ugi =
                UserGroupInformation.createProxyUser(userToProxy,
                    UserGroupInformation.getLoginUser());
          } catch (final IOException e) {
            throw new HadoopSecurityManagerException(
                "Failed to create proxy user", e);
          }
        } else {
          ugi = UserGroupInformation.createRemoteUser(userToProxy);
        }
        this.userUgiMap.putIfAbsent(userToProxy, ugi);
      }
      return ugi;
    }
docs: Create a proxied user based on the explicit user name, taking other parameters necessary from
  properties file.