This is an automated email from the ASF dual-hosted git repository.
zhangbutao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new 57e80a20aaf HIVE-28502: Refactor method names that start with capital
letters in PasswdAuthenticationProvider class (#5434)(Dmitriy Fingerman,
reviewed by Denys Kuzmenko, Butao Zhang)
57e80a20aaf is described below
commit 57e80a20aafdc5fe1c4e3c4851a24252fad09825
Author: Dmitriy Fingerman <[email protected]>
AuthorDate: Fri Sep 13 11:36:13 2024 -0400
HIVE-28502: Refactor method names that start with capital letters in
PasswdAuthenticationProvider class (#5434)(Dmitriy Fingerman, reviewed by Denys
Kuzmenko, Butao Zhang)
---
.../minikdc/TestJdbcNonKrbSASLWithMiniKdc.java | 2 +-
.../service/auth/TestCustomAuthentication.java | 2 +-
.../auth/TrustDomainAuthenticationTest.java | 2 +-
.../auth/AnonymousAuthenticationProviderImpl.java | 2 +-
.../auth/CustomAuthenticationProviderImpl.java | 4 ++--
.../auth/LdapAuthenticationProviderImpl.java | 2 +-
.../auth/PamAuthenticationProviderImpl.java | 2 +-
.../service/auth/PasswdAuthenticationProvider.java | 2 +-
.../apache/hive/service/auth/PlainSaslHelper.java | 3 +--
.../hive/service/auth/ldap/LdapAuthService.java | 2 +-
.../hive/service/cli/thrift/ThriftHttpServlet.java | 2 +-
.../auth/TestLdapAuthenticationProviderImpl.java | 28 +++++++++++-----------
.../auth/ldap/LdapAuthenticationTestCase.java | 4 ++--
.../hive/service/server/TestHS2HttpServerLDAP.java | 2 +-
14 files changed, 29 insertions(+), 30 deletions(-)
diff --git
a/itests/hive-minikdc/src/test/java/org/apache/hive/minikdc/TestJdbcNonKrbSASLWithMiniKdc.java
b/itests/hive-minikdc/src/test/java/org/apache/hive/minikdc/TestJdbcNonKrbSASLWithMiniKdc.java
index 948c7daded1..31623a4d290 100644
---
a/itests/hive-minikdc/src/test/java/org/apache/hive/minikdc/TestJdbcNonKrbSASLWithMiniKdc.java
+++
b/itests/hive-minikdc/src/test/java/org/apache/hive/minikdc/TestJdbcNonKrbSASLWithMiniKdc.java
@@ -42,7 +42,7 @@ public class TestJdbcNonKrbSASLWithMiniKdc extends
TestJdbcWithMiniKdc{
public static class CustomAuthenticator implements
PasswdAuthenticationProvider {
@Override
- public void Authenticate(String user, String password) throws
AuthenticationException {
+ public void authenticate(String user, String password) throws
AuthenticationException {
if (!(SASL_NONKRB_USER1.equals(user) &&
SASL_NONKRB_PWD.equals(password)) &&
!(SASL_NONKRB_USER2.equals(user) &&
SASL_NONKRB_PWD.equals(password))) {
throw new AuthenticationException("Authentication failed");
diff --git
a/itests/hive-unit/src/test/java/org/apache/hive/service/auth/TestCustomAuthentication.java
b/itests/hive-unit/src/test/java/org/apache/hive/service/auth/TestCustomAuthentication.java
index 9705c65af89..b866f8d1fe7 100644
---
a/itests/hive-unit/src/test/java/org/apache/hive/service/auth/TestCustomAuthentication.java
+++
b/itests/hive-unit/src/test/java/org/apache/hive/service/auth/TestCustomAuthentication.java
@@ -108,7 +108,7 @@ public class TestCustomAuthentication {
}
@Override
- public void Authenticate(String user, String password) throws
AuthenticationException {
+ public void authenticate(String user, String password) throws
AuthenticationException {
if(!userMap.containsKey(user)){
throw new AuthenticationException("Invalid user : "+user);
diff --git
a/itests/hive-unit/src/test/java/org/apache/hive/service/auth/TrustDomainAuthenticationTest.java
b/itests/hive-unit/src/test/java/org/apache/hive/service/auth/TrustDomainAuthenticationTest.java
index e83ac0e97f5..f2fe7076b80 100644
---
a/itests/hive-unit/src/test/java/org/apache/hive/service/auth/TrustDomainAuthenticationTest.java
+++
b/itests/hive-unit/src/test/java/org/apache/hive/service/auth/TrustDomainAuthenticationTest.java
@@ -183,7 +183,7 @@ public abstract class TrustDomainAuthenticationTest {
}
@Override
- public void Authenticate(String user, String password) throws
AuthenticationException {
+ public void authenticate(String user, String password) throws
AuthenticationException {
if(!userMap.containsKey(user)){
throw new AuthenticationException("Invalid user : "+user);
diff --git
a/service/src/java/org/apache/hive/service/auth/AnonymousAuthenticationProviderImpl.java
b/service/src/java/org/apache/hive/service/auth/AnonymousAuthenticationProviderImpl.java
index ece3c756faf..566fe3d38b8 100644
---
a/service/src/java/org/apache/hive/service/auth/AnonymousAuthenticationProviderImpl.java
+++
b/service/src/java/org/apache/hive/service/auth/AnonymousAuthenticationProviderImpl.java
@@ -26,7 +26,7 @@ import javax.security.sasl.AuthenticationException;
public class AnonymousAuthenticationProviderImpl implements
PasswdAuthenticationProvider {
@Override
- public void Authenticate(String user, String password) throws
AuthenticationException {
+ public void authenticate(String user, String password) throws
AuthenticationException {
// no-op authentication
}
diff --git
a/service/src/java/org/apache/hive/service/auth/CustomAuthenticationProviderImpl.java
b/service/src/java/org/apache/hive/service/auth/CustomAuthenticationProviderImpl.java
index 3d7ccd96fea..ab6f20330b0 100644
---
a/service/src/java/org/apache/hive/service/auth/CustomAuthenticationProviderImpl.java
+++
b/service/src/java/org/apache/hive/service/auth/CustomAuthenticationProviderImpl.java
@@ -50,8 +50,8 @@ public class CustomAuthenticationProviderImpl implements
PasswdAuthenticationPro
}
@Override
- public void Authenticate(String user, String password) throws
AuthenticationException {
- customProvider.Authenticate(user, password);
+ public void authenticate(String user, String password) throws
AuthenticationException {
+ customProvider.authenticate(user, password);
}
}
diff --git
a/service/src/java/org/apache/hive/service/auth/LdapAuthenticationProviderImpl.java
b/service/src/java/org/apache/hive/service/auth/LdapAuthenticationProviderImpl.java
index 31351b1da4a..cd8dedc01d0 100644
---
a/service/src/java/org/apache/hive/service/auth/LdapAuthenticationProviderImpl.java
+++
b/service/src/java/org/apache/hive/service/auth/LdapAuthenticationProviderImpl.java
@@ -69,7 +69,7 @@ public class LdapAuthenticationProviderImpl implements
PasswdAuthenticationProvi
}
@Override
- public void Authenticate(String user, String password) throws
AuthenticationException {
+ public void authenticate(String user, String password) throws
AuthenticationException {
DirSearch search = null;
String bindUser =
this.conf.getVar(HiveConf.ConfVars.HIVE_SERVER2_PLAIN_LDAP_BIND_USER);
String bindPassword = null;
diff --git
a/service/src/java/org/apache/hive/service/auth/PamAuthenticationProviderImpl.java
b/service/src/java/org/apache/hive/service/auth/PamAuthenticationProviderImpl.java
index fff378a7e9e..f430e954ce6 100644
---
a/service/src/java/org/apache/hive/service/auth/PamAuthenticationProviderImpl.java
+++
b/service/src/java/org/apache/hive/service/auth/PamAuthenticationProviderImpl.java
@@ -32,7 +32,7 @@ public class PamAuthenticationProviderImpl implements
PasswdAuthenticationProvid
}
@Override
- public void Authenticate(String user, String password) throws
AuthenticationException {
+ public void authenticate(String user, String password) throws
AuthenticationException {
if (pamServiceNames == null || pamServiceNames.trim().isEmpty()) {
throw new AuthenticationException("No PAM services are set.");
diff --git
a/service/src/java/org/apache/hive/service/auth/PasswdAuthenticationProvider.java
b/service/src/java/org/apache/hive/service/auth/PasswdAuthenticationProvider.java
index fdc6857a929..a97bae13fc2 100644
---
a/service/src/java/org/apache/hive/service/auth/PasswdAuthenticationProvider.java
+++
b/service/src/java/org/apache/hive/service/auth/PasswdAuthenticationProvider.java
@@ -35,5 +35,5 @@ public interface PasswdAuthenticationProvider {
* @throws AuthenticationException When a user is found to be
* invalid by the implementation
*/
- void Authenticate(String user, String password) throws
AuthenticationException;
+ void authenticate(String user, String password) throws
AuthenticationException;
}
diff --git a/service/src/java/org/apache/hive/service/auth/PlainSaslHelper.java
b/service/src/java/org/apache/hive/service/auth/PlainSaslHelper.java
index 66a803ba355..775893abedf 100644
--- a/service/src/java/org/apache/hive/service/auth/PlainSaslHelper.java
+++ b/service/src/java/org/apache/hive/service/auth/PlainSaslHelper.java
@@ -18,7 +18,6 @@
package org.apache.hive.service.auth;
import java.io.IOException;
-import java.net.InetAddress;
import java.security.Security;
import java.util.HashMap;
@@ -160,7 +159,7 @@ public final class PlainSaslHelper {
PasswdAuthenticationProvider provider =
AuthenticationProviderFactory.getAuthenticationProvider(authMethod);
try {
- provider.Authenticate(username, password);
+ provider.authenticate(username, password);
} catch (Exception e) {
LOG.error("Login attempt is failed for user : " + username + ". Error
Messsage : " + e.getMessage());
throw e;
diff --git
a/service/src/java/org/apache/hive/service/auth/ldap/LdapAuthService.java
b/service/src/java/org/apache/hive/service/auth/ldap/LdapAuthService.java
index be047099b4e..42d38facd83 100644
--- a/service/src/java/org/apache/hive/service/auth/ldap/LdapAuthService.java
+++ b/service/src/java/org/apache/hive/service/auth/ldap/LdapAuthService.java
@@ -69,7 +69,7 @@ public class LdapAuthService extends HttpAuthService {
String clientUserName = validateCookie(request);
if (clientUserName == null) {
clientUserName = getUsername(request);
- authProvider.Authenticate(clientUserName, getPassword(request));
+ authProvider.authenticate(clientUserName, getPassword(request));
String cookieToken = HttpAuthUtils.createCookieToken(clientUserName);
Cookie hs2Cookie = signAndCreateCookie(cookieToken);
diff --git
a/service/src/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java
b/service/src/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java
index 05e33cff9cb..ea774e2eb05 100644
--- a/service/src/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java
+++ b/service/src/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java
@@ -417,7 +417,7 @@ public class ThriftHttpServlet extends TServlet {
AuthMethods authMethod = AuthMethods.getValidAuthMethod(authType);
PasswdAuthenticationProvider provider =
AuthenticationProviderFactory.getAuthenticationProvider(authMethod, hiveConf);
- provider.Authenticate(userName, httpAuthService.getPassword(request));
+ provider.authenticate(userName, httpAuthService.getPassword(request));
} catch (Exception e) {
throw new HttpAuthenticationException(e);
}
diff --git
a/service/src/test/org/apache/hive/service/auth/TestLdapAuthenticationProviderImpl.java
b/service/src/test/org/apache/hive/service/auth/TestLdapAuthenticationProviderImpl.java
index c8632aefb9d..7faa404752d 100644
---
a/service/src/test/org/apache/hive/service/auth/TestLdapAuthenticationProviderImpl.java
+++
b/service/src/test/org/apache/hive/service/auth/TestLdapAuthenticationProviderImpl.java
@@ -63,21 +63,21 @@ public class TestLdapAuthenticationProviderImpl {
public void authenticateGivenBlankPassword() throws Exception {
auth = new LdapAuthenticationProviderImpl(conf, new LdapSearchFactory());
expectAuthenticationExceptionForInvalidPassword();
- auth.Authenticate("user", "");
+ auth.authenticate("user", "");
}
@Test
public void authenticateGivenStringWithNullCharacterForPassword() throws
Exception {
auth = new LdapAuthenticationProviderImpl(conf, new LdapSearchFactory());
expectAuthenticationExceptionForInvalidPassword();
- auth.Authenticate("user", "\0");
+ auth.authenticate("user", "\0");
}
@Test
public void authenticateGivenNullForPassword() throws Exception {
auth = new LdapAuthenticationProviderImpl(conf, new LdapSearchFactory());
expectAuthenticationExceptionForInvalidPassword();
- auth.Authenticate("user", null);
+ auth.authenticate("user", null);
}
@Test
@@ -93,7 +93,7 @@ public class TestLdapAuthenticationProviderImpl {
when(factory.getInstance(conf, "cn=user1,ou=Users,dc=mycorp,dc=com",
"Blah")).thenThrow(AuthenticationException.class);
auth = new LdapAuthenticationProviderImpl(conf, factory);
- auth.Authenticate("user1", "Blah");
+ auth.authenticate("user1", "Blah");
verify(factory, times(2)).getInstance(isA(HiveConf.class), anyString(),
eq("Blah"));
verify(search, atLeastOnce()).close();
@@ -271,7 +271,7 @@ public class TestLdapAuthenticationProviderImpl {
when(search.isUserMemberOfGroup("user1", groupDn)).thenReturn(true);
auth = new LdapAuthenticationProviderImpl(conf, factory);
- auth.Authenticate("user1", "Blah");
+ auth.authenticate("user1", "Blah");
verify(factory, times(1)).getInstance(isA(HiveConf.class), anyString(),
eq("Blah"));
verify(search, times(1)).findGroupDn(anyString());
@@ -293,7 +293,7 @@ public class TestLdapAuthenticationProviderImpl {
when(search.isUserMemberOfGroup("user1", groupDn)).thenReturn(false);
auth = new LdapAuthenticationProviderImpl(conf, factory);
- auth.Authenticate("user1", "Blah");
+ auth.authenticate("user1", "Blah");
}
@Test
@@ -316,7 +316,7 @@ public class TestLdapAuthenticationProviderImpl {
when(search.isUserMemberOfGroup("user1",
"cn=HIVE-USERS2,ou=Groups,ou=branch1,dc=mycorp,dc=com")).thenReturn(true);
auth = new LdapAuthenticationProviderImpl(conf, factory);
- auth.Authenticate("user1", "Blah");
+ auth.authenticate("user1", "Blah");
verify(factory, times(1)).getInstance(isA(HiveConf.class), anyString(),
eq("Blah"));
verify(search, times(2)).findGroupDn(anyString());
@@ -341,7 +341,7 @@ public class TestLdapAuthenticationProviderImpl {
when(search.findUserDn(eq(authUser))).thenReturn(authFullUser);
auth = new LdapAuthenticationProviderImpl(conf, factory);
- auth.Authenticate(authUser, authPass);
+ auth.authenticate(authUser, authPass);
verify(factory, times(1)).getInstance(isA(HiveConf.class), eq(bindUser),
eq(bindPass));
verify(factory, times(1)).getInstance(isA(HiveConf.class),
eq(authFullUser), eq(authPass));
@@ -359,7 +359,7 @@ public class TestLdapAuthenticationProviderImpl {
conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH,
credentialsPath);
auth = new LdapAuthenticationProviderImpl(conf, factory);
- auth.Authenticate(authUser, authPass);
+ auth.authenticate(authUser, authPass);
verify(factory, times(1)).getInstance(isA(HiveConf.class), eq(authUser),
eq(authPass));
}
@@ -377,7 +377,7 @@ public class TestLdapAuthenticationProviderImpl {
when(search.findUserDn(eq(authUser))).thenReturn(authFullUser);
auth = new LdapAuthenticationProviderImpl(conf, factory);
- auth.Authenticate(authUser, authPass);
+ auth.authenticate(authUser, authPass);
verify(factory, times(1)).getInstance(isA(HiveConf.class), eq(bindUser),
eq(bindPass));
verify(factory, times(1)).getInstance(isA(HiveConf.class),
eq(authFullUser), eq(authPass));
@@ -400,7 +400,7 @@ public class TestLdapAuthenticationProviderImpl {
when(search.findUserDn(eq(authUser))).thenReturn(authFullUser);
auth = new LdapAuthenticationProviderImpl(conf, factory);
- auth.Authenticate(authUser, authPass);
+ auth.authenticate(authUser, authPass);
}
@Test
@@ -417,7 +417,7 @@ public class TestLdapAuthenticationProviderImpl {
when(search.findUserDn(eq(authUser))).thenThrow(NamingException.class);
auth = new LdapAuthenticationProviderImpl(conf, factory);
- auth.Authenticate(authUser, authPass);
+ auth.authenticate(authUser, authPass);
}
@Test
@@ -433,7 +433,7 @@ public class TestLdapAuthenticationProviderImpl {
when(factory.getInstance(any(HiveConf.class), eq(bindUser),
eq(bindPass))).thenThrow(AuthenticationException.class);
auth = new LdapAuthenticationProviderImpl(conf, factory);
- auth.Authenticate(authUser, authPass);
+ auth.authenticate(authUser, authPass);
}
private void expectAuthenticationExceptionForInvalidPassword() {
@@ -444,7 +444,7 @@ public class TestLdapAuthenticationProviderImpl {
private void authenticateUserAndCheckSearchIsClosed(String user) throws
IOException {
auth = new LdapAuthenticationProviderImpl(conf, factory);
try {
- auth.Authenticate(user, "password doesn't matter");
+ auth.authenticate(user, "password doesn't matter");
} finally {
verify(search, atLeastOnce()).close();
}
diff --git
a/service/src/test/org/apache/hive/service/auth/ldap/LdapAuthenticationTestCase.java
b/service/src/test/org/apache/hive/service/auth/ldap/LdapAuthenticationTestCase.java
index 40b99f47b90..575ac59b558 100644
---
a/service/src/test/org/apache/hive/service/auth/ldap/LdapAuthenticationTestCase.java
+++
b/service/src/test/org/apache/hive/service/auth/ldap/LdapAuthenticationTestCase.java
@@ -42,7 +42,7 @@ public final class LdapAuthenticationTestCase {
public void assertAuthenticatePasses(Credentials credentials) {
try {
- ldapProvider.Authenticate(credentials.getUser(),
credentials.getPassword());
+ ldapProvider.authenticate(credentials.getUser(),
credentials.getPassword());
} catch (AuthenticationException e) {
String message = String.format("Authentication failed for user '%s' with
password '%s'",
credentials.getUser(), credentials.getPassword());
@@ -60,7 +60,7 @@ public final class LdapAuthenticationTestCase {
public void assertAuthenticateFails(String user, String password) {
try {
- ldapProvider.Authenticate(user, password);
+ ldapProvider.authenticate(user, password);
Assert.fail(String.format("Expected authentication to fail for %s",
user));
} catch (AuthenticationException expected) {
Assert.assertNotNull("Expected authentication exception", expected);
diff --git
a/service/src/test/org/apache/hive/service/server/TestHS2HttpServerLDAP.java
b/service/src/test/org/apache/hive/service/server/TestHS2HttpServerLDAP.java
index 5d48d1323f8..cdcf98ca7f6 100644
--- a/service/src/test/org/apache/hive/service/server/TestHS2HttpServerLDAP.java
+++ b/service/src/test/org/apache/hive/service/server/TestHS2HttpServerLDAP.java
@@ -185,7 +185,7 @@ public class TestHS2HttpServerLDAP {
public static class DummyLdapAuthenticationProviderImpl implements
PasswdAuthenticationProvider {
@Override
- public void Authenticate(String user, String password) throws
AuthenticationException {
+ public void authenticate(String user, String password) throws
AuthenticationException {
if (!(user.equals(VALID_USER) && password.equals(VALID_PASS)))
throw new AuthenticationException();
}