/** * A test method to print out the current user's UGI. * * @param args if there are two arguments, read the user from the keytab and print it out. * @throws Exception */ public static void main(String[] args) throws Exception { System.out.println("Getting UGI for current user"); UserGroupInformation ugi = getCurrentUser(); ugi.print(); System.out.println("UGI: " + ugi); System.out.println("Auth method " + ugi.user.getAuthenticationMethod()); System.out.println("Keytab " + ugi.isKeytab); System.out.println("============================================================"); if (args.length == 2) { System.out.println("Getting UGI from keytab...."); loginUserFromKeytab(args[0], args[1]); getCurrentUser().print(); System.out.println("Keytab: " + ugi); System.out.println("Auth method " + loginUser.user.getAuthenticationMethod()); System.out.println("Keytab " + loginUser.isKeytab); } }