diff --git a/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/authentication/UserModifyingApplication.java b/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/authentication/UserModifyingApplication.java
index 836d21f9ceea3..a35c0fbc04f79 100644
--- a/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/authentication/UserModifyingApplication.java
+++ b/modules/ducktests/src/main/java/org/apache/ignite/internal/ducktest/tests/authentication/UserModifyingApplication.java
@@ -19,10 +19,8 @@
import com.fasterxml.jackson.databind.JsonNode;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.internal.ducktest.utils.IgniteAwareApplication;
-import org.apache.ignite.internal.processors.authentication.AuthorizationContext;
-import org.apache.ignite.internal.processors.authentication.IgniteAuthenticationProcessor;
import org.apache.ignite.internal.processors.rest.GridRestCommand;
/**
@@ -30,39 +28,28 @@
*/
public class UserModifyingApplication extends IgniteAwareApplication {
/** {@inheritDoc} */
- @Override public void run(JsonNode jsonNode) throws IgniteCheckedException {
+ @Override public void run(final JsonNode jsonNode) throws IgniteCheckedException {
String restKey = jsonNode.get("rest_key").asText();
- String authName = jsonNode.get("auth_username").asText();
-
- String authPwd = jsonNode.get("auth_password").asText();
-
String name = jsonNode.get("username").asText();
String pwd = jsonNode.get("password").asText();
markInitialized();
- log.info("Input data: " + jsonNode.toString());
-
- IgniteAuthenticationProcessor auth = ((IgniteEx)ignite).context().authentication();
-
- AuthorizationContext actx = auth.authenticate(authName, authPwd);
- AuthorizationContext.context(actx);
-
GridRestCommand cmd = GridRestCommand.fromKey(restKey);
switch (cmd) {
case ADD_USER:
- auth.addUser(name, pwd);
+ client.query(new SqlFieldsQuery(String.format("CREATE USER \"%s\" WITH PASSWORD '%s';", name, pwd))).getAll();
break;
case UPDATE_USER:
- auth.updateUser(name, pwd);
+ client.query(new SqlFieldsQuery(String.format("ALTER USER \"%s\" WITH PASSWORD '%s';", name, pwd))).getAll();
break;
case REMOVE_USER:
- auth.removeUser(name);
+ client.query(new SqlFieldsQuery(String.format("DROP USER \"%s\";", name))).getAll();
break;
default:
diff --git a/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py b/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py
index 5f6d433bfb4b2..f8e52794ff8c0 100644
--- a/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py
+++ b/modules/ducktests/tests/ignitetest/services/utils/ignite_configuration/__init__.py
@@ -127,6 +127,8 @@ class IgniteThinClientConfiguration(NamedTuple):
addresses: str = None
version: IgniteVersion = DEV_BRANCH
ssl_params: SslParams = None
+ username: str = None
+ password: str = None
def __prepare_ssl(self, test_globals, shared_root):
"""
diff --git a/modules/ducktests/tests/ignitetest/services/utils/templates/thin_client_config.xml.j2 b/modules/ducktests/tests/ignitetest/services/utils/templates/thin_client_config.xml.j2
index e58b02a08495d..7ec955b5c1b9b 100644
--- a/modules/ducktests/tests/ignitetest/services/utils/templates/thin_client_config.xml.j2
+++ b/modules/ducktests/tests/ignitetest/services/utils/templates/thin_client_config.xml.j2
@@ -28,6 +28,11 @@
+ {% if config.username %}
+
+
+ {% endif %}
+
{% if config.ssl_params %}
diff --git a/modules/ducktests/tests/ignitetest/tests/auth_test.py b/modules/ducktests/tests/ignitetest/tests/auth_test.py
index 73d4bc04874bd..4999b097004a2 100644
--- a/modules/ducktests/tests/ignitetest/tests/auth_test.py
+++ b/modules/ducktests/tests/ignitetest/tests/auth_test.py
@@ -24,7 +24,8 @@
from ignitetest.services.utils.ignite_configuration import IgniteConfiguration, DataStorageConfiguration
from ignitetest.services.utils.ignite_configuration.data_storage import DataRegionConfiguration
from ignitetest.utils import ignite_versions, cluster
-from ignitetest.services.utils.ignite_configuration.discovery import from_ignite_cluster
+from ignitetest.services.utils.ignite_configuration import IgniteThinClientConfiguration
+from ignitetest.services.utils.ssl.client_connector_configuration import ClientConnectorConfiguration
from ignitetest.utils.ignite_test import IgniteTest
from ignitetest.utils.version import DEV_BRANCH, LATEST, IgniteVersion
@@ -57,8 +58,8 @@ def test_change_users(self, ignite_version):
auth_enabled=True,
version=IgniteVersion(ignite_version),
data_storage=DataStorageConfiguration(
- default=DataRegionConfiguration(persistent=True),
- )
+ default=DataRegionConfiguration(persistent=True)),
+ client_connector_configuration=ClientConnectorConfiguration()
)
servers = IgniteService(self.test_context, config=config, num_nodes=self.NUM_NODES - 1)
@@ -67,7 +68,11 @@ def test_change_users(self, ignite_version):
ControlUtility(cluster=servers, username=DEFAULT_AUTH_USERNAME, password=DEFAULT_AUTH_PASSWORD).activate()
- client_cfg = config._replace(client_mode=True, discovery_spi=from_ignite_cluster(servers))
+ client_cfg = IgniteThinClientConfiguration(
+ addresses=servers.nodes[0].account.hostname + ":" + str(config.client_connector_configuration.port),
+ version=IgniteVersion(ignite_version),
+ username=DEFAULT_AUTH_USERNAME,
+ password=DEFAULT_AUTH_PASSWORD)
# Add new user
check_authenticate(servers, TEST_USERNAME, TEST_PASSWORD, True)
@@ -95,8 +100,6 @@ def run_with_creds(self, client_configuration, rest_key: str, name: str, passwor
client_configuration,
java_class_name="org.apache.ignite.internal.ducktest.tests.authentication.UserModifyingApplication",
params={"rest_key": rest_key,
- "auth_username": DEFAULT_AUTH_USERNAME,
- "auth_password": DEFAULT_AUTH_PASSWORD,
"username": name,
"password": password}
)