Re: [PR] HBASE-30042 Test AuthUtil.loginClient with existing Kerberos login [hbase]

2026-03-31 Thread via GitHub


junegunn merged PR #8002:
URL: https://github.com/apache/hbase/pull/8002


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] HBASE-30042 Test AuthUtil.loginClient with existing Kerberos login [hbase]

2026-03-30 Thread via GitHub


jinhyukify commented on code in PR #8002:
URL: https://github.com/apache/hbase/pull/8002#discussion_r3013756518


##
hbase-server/src/test/java/org/apache/hadoop/hbase/security/TestUsersOperationsWithSecureHadoop.java:
##
@@ -133,13 +133,14 @@ public void testLoginWithUserKeytabAndPrincipal() throws 
Exception {
   }
 
   @Test
-  public void testAuthUtilLogin() throws Exception {
+  public void testAuthUtilLoginWithExistingLoginUser() throws Exception {
 String clientKeytab = getClientKeytabForTesting();
 String clientPrincipal = getClientPrincipalForTesting();
 Configuration conf = getSecuredConfiguration();
 conf.set(AuthUtil.HBASE_CLIENT_KEYTAB_FILE, clientKeytab);
 conf.set(AuthUtil.HBASE_CLIENT_KERBEROS_PRINCIPAL, clientPrincipal);
 UserGroupInformation.setConfiguration(conf);
+UserGroupInformation.loginUserFromKeytab(clientPrincipal, clientKeytab);

Review Comment:
   Thank you for your feedback.
   
   I updated my test a bit.
   
   `AuthUtil.loginClient` has the following branches:
   ### 1. No Kerberos credentials (not logged in)
   I think this cannot be tested in MiniKdc environment. Even without an 
explicit login, `AuthUtil.loginClient` picks up the kinit principal from the 
ticket cache, which fails with `KerberosName$NoMatchingRule` because we don't 
have `auth_to_local` rules configured. So I just skipped.
   ### 2. Kerberos credentials exist (already logged in)
   
   - 2-a. Current login principal matches conf → return as-is 
(testAuthUtilLoginWithExistingLoginUser)
   - 2-b. Mismatch → re-login with the configured principal 
(testAuthUtilLoginWithDifferentExistingUser)
   
   Both cases are now covered.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] HBASE-30042 Test AuthUtil.loginClient with existing Kerberos login [hbase]

2026-03-29 Thread via GitHub


junegunn commented on code in PR #8002:
URL: https://github.com/apache/hbase/pull/8002#discussion_r3007078485


##
hbase-server/src/test/java/org/apache/hadoop/hbase/security/TestUsersOperationsWithSecureHadoop.java:
##
@@ -133,13 +133,14 @@ public void testLoginWithUserKeytabAndPrincipal() throws 
Exception {
   }
 
   @Test
-  public void testAuthUtilLogin() throws Exception {
+  public void testAuthUtilLoginWithExistingLoginUser() throws Exception {
 String clientKeytab = getClientKeytabForTesting();
 String clientPrincipal = getClientPrincipalForTesting();
 Configuration conf = getSecuredConfiguration();
 conf.set(AuthUtil.HBASE_CLIENT_KEYTAB_FILE, clientKeytab);
 conf.set(AuthUtil.HBASE_CLIENT_KERBEROS_PRINCIPAL, clientPrincipal);
 UserGroupInformation.setConfiguration(conf);
+UserGroupInformation.loginUserFromKeytab(clientPrincipal, clientKeytab);

Review Comment:
   Thanks, this issue has been bothering me for a while, and I can confirm this 
makes the test pass.
   
   However, if we do this, we no longer test if `AuthUtil.loginClient` actually 
performs the login for the user. I think we could create a separate user 
principal, log in as that user, and then test whether ⁠`AuthUtil.loginClient` 
correctly logs in the original user and returns that user.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



Re: [PR] HBASE-30042 Test AuthUtil.loginClient with existing Kerberos login [hbase]

2026-03-29 Thread via GitHub


jinhyukify commented on code in PR #8002:
URL: https://github.com/apache/hbase/pull/8002#discussion_r3006359501


##
hbase-server/src/test/java/org/apache/hadoop/hbase/security/TestUsersOperationsWithSecureHadoop.java:
##
@@ -133,13 +133,14 @@ public void testLoginWithUserKeytabAndPrincipal() throws 
Exception {
   }
 
   @Test
-  public void testAuthUtilLogin() throws Exception {
+  public void testAuthUtilLoginWithExistingLoginUser() throws Exception {

Review Comment:
   Let's update this test to only cover the case where a Kerberos user is 
already logged in.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]