【问题标题】:impersonate a user at runtime for spring hadoop configuration在运行时模拟用户进行 spring hadoop 配置
【发布时间】:2013-11-18 22:40:48
【问题描述】:

我有一个 Web 应用程序,它接收来自不同用户的从 linux 命令行运行的其他几个应用程序的请求。对于这些请求中的每一个,我都必须从 hdfs 读取数据以调用只有调用应用程序 linux 用户才能访问的应用程序文件夹。有没有一种方法可以设置配置,使其可以在运行时被覆盖,以模拟调用者应用程序用户进行 spring-hadoop kerberos 身份验证。

【问题讨论】:

    标签: spring hadoop spring-data


    【解决方案1】:
    UserGroupInformation ugi = UserGroupInformation.createProxyUser("user", UserGroupInformation.getLoginUser());
        ugi.doAs(new PrivilegedExceptionAction<Void>() {
            @Override
            public Void run() throws Exception {
                fsh.cp(file.getSourceFilePath(), destPathWithFileName);
                return null;
            }
        }); 
    

    【讨论】:

      猜你喜欢
      • 2013-12-24
      • 2020-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-27
      • 1970-01-01
      • 2011-02-03
      相关资源
      最近更新 更多