Created
October 30, 2020 22:19
-
-
Save bbhavsar/4b11bd8b5ea92bb3bbbdc629fb779806 to your computer and use it in GitHub Desktop.
Kudu Kerberos Ticket Cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static KuduClient GetTicketCacheClient() { | |
Subject subject = SecurityUtil.getSubjectFromTicketCacheOrNull(); | |
if (subject == null) { | |
System.out.println("Subject not available from ticket cache"); | |
System.exit(1); | |
} | |
KuduClient client = null; | |
try { | |
client = Subject.doAs(subject, new PrivilegedExceptionAction<KuduClient>() { | |
public KuduClient run() throws Exception { | |
return new KuduClientBuilder("bankim-b-1.gce.cloudera.com:7051").build(); | |
} | |
}); | |
} catch (Exception ex) { | |
System.out.println("Error in ticket cache: " + ex.getMessage()); | |
} | |
return client; | |
} | |
public static void main(String[] args) { | |
KuduClient client = GetTicketCacheClient(); | |
ListTables(client); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment