Skip to content

Commit

Permalink
Avoid pass null principal name when use cached tkt
Browse files Browse the repository at this point in the history
  • Loading branch information
ShijunK authored and rwinch committed May 28, 2024
1 parent 3650998 commit c7ecaea
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ private static HttpClient buildHttpClient() {
private LoginContext buildLoginContext() throws LoginException {
ClientLoginConfig loginConfig = new ClientLoginConfig(keyTabLocation, userPrincipal, password, loginOptions);
Set<Principal> princ = new HashSet<Principal>(1);
princ.add(new KerberosPrincipal(userPrincipal));
if (userPrincipal != null) {
princ.add(new KerberosPrincipal(userPrincipal));
}
Subject sub = new Subject(false, princ, new HashSet<Object>(), new HashSet<Object>());
CallbackHandler callbackHandler = new CallbackHandlerImpl(userPrincipal, password);
LoginContext lc = new LoginContext("", sub, callbackHandler, loginConfig);
Expand Down

0 comments on commit c7ecaea

Please sign in to comment.