How to get access to hdfs using kerberos service ticket

32 Views Asked by At

I'm using Apache Kerby for generation tgt and then service ticket (sgt) to particular resource hdfs. Then save these both tickets to one file (myTicket). Then I use UserGroupInformation.getBestUgi(myTicket, user). It works fine but in logs I can see that UserGroupInformation goes to TGS for service ticket despite of the fact that it already got it. I am sure my ticket is right. How to avoid exta call to TGS? Is it possible using UserGroupInformation or there is other way?

I tried this code

Configuration config = new Configuration();
config.set("hadoop.security.authentication", "kerberos");
config.set("hadoop.kerberos.ticket.renew", "false");
UserGroupInformation.setConfiguration(config);

UserGroupInformation ugi = UserGroupInformation.getBestUgi(myTicket, user);
FileSystem hdfs = ugi.doAs((PrivilegedAction<FileSystem>) () -> {
        try {
             return FileSystem.get(config);  
        } catch (Exception e) {
             throw new RuntimeExeption();
        }
}
0

There are 0 best solutions below