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]