You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by na...@apache.org on 2021/12/09 09:40:07 UTC

[ignite] branch ignite-2.12 updated: IGNITE-15969 Remove persistence mode requirement on the client node with authentication enabled (#9627)

This is an automated email from the ASF dual-hosted git repository.

namelchev pushed a commit to branch ignite-2.12
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/ignite-2.12 by this push:
     new ac65ca5  IGNITE-15969 Remove persistence mode requirement on the client node with authentication enabled (#9627)
ac65ca5 is described below

commit ac65ca50ec437e3119bc321699382cc5680ff4bf
Author: Shishkov Ilya <sh...@gmail.com>
AuthorDate: Wed Dec 8 18:37:33 2021 +0300

    IGNITE-15969 Remove persistence mode requirement on the client node with authentication enabled (#9627)
    
    (cherry picked from commit 5a59a2f694433d367e48139af69512dd78ac4521)
---
 .../IgniteAuthenticationProcessor.java             |  4 ++--
 .../AuthenticationConfigurationClusterTest.java    | 22 +++++++++++++++++++++-
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/authentication/IgniteAuthenticationProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/authentication/IgniteAuthenticationProcessor.java
index 31c7262..afc60bd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/authentication/IgniteAuthenticationProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/authentication/IgniteAuthenticationProcessor.java
@@ -47,7 +47,6 @@ import org.apache.ignite.internal.managers.eventstorage.DiscoveryEventListener;
 import org.apache.ignite.internal.processors.GridProcessorAdapter;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.GridCacheUtils;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
 import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.PartitionsExchangeAware;
 import org.apache.ignite.internal.processors.cache.persistence.metastorage.MetastorageLifecycleListener;
@@ -61,6 +60,7 @@ import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.util.worker.GridWorker;
@@ -162,7 +162,7 @@ public class IgniteAuthenticationProcessor extends GridProcessorAdapter implemen
 
     /** Starts processor. */
     public void startProcessor() throws IgniteCheckedException {
-        if (!GridCacheUtils.isPersistenceEnabled(ctx.config())) {
+        if (!ctx.clientNode() && !CU.isPersistenceEnabled(ctx.config())) {
             throw new IgniteCheckedException("Authentication can be enabled only for cluster with enabled persistence."
                 + " Check the DataRegionConfiguration");
         }
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationConfigurationClusterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationConfigurationClusterTest.java
index 71f34f4..31d2844 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationConfigurationClusterTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/authentication/AuthenticationConfigurationClusterTest.java
@@ -30,6 +30,7 @@ import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.junit.Test;
 
+import static org.apache.ignite.cluster.ClusterState.ACTIVE;
 import static org.apache.ignite.internal.processors.authentication.AuthenticationProcessorSelfTest.authenticate;
 import static org.apache.ignite.internal.processors.security.NoOpIgniteSecurityProcessor.SECURITY_DISABLED_ERROR_MSG;
 import static org.apache.ignite.plugin.security.SecurityPermissionSetBuilder.ALLOW_ALL;
@@ -124,7 +125,7 @@ public class AuthenticationConfigurationClusterTest extends GridCommonAbstractTe
      * Checks that a new node cannot join a cluster with a different authentication enable state.
      *
      * @param client Is joining node client.
-     * @param authEnabled Whether authentication is enabled on joining node.
+     * @param authEnabled Whether authentication is enabled on server node, which accepts join of new node.
      * @throws Exception If failed.
      */
     private void checkNodeJoinFailed(boolean client, boolean authEnabled) throws Exception {
@@ -211,4 +212,23 @@ public class AuthenticationConfigurationClusterTest extends GridCommonAbstractTe
             IgniteCheckedException.class,
             "Invalid security configuration: both authentication is enabled and external security plugin is provided.");
     }
+
+    /**
+     * Tests that client node configured with authentication but without persistence could start and join the cluster.
+     */
+    @Test
+    public void testClientNodeWithoutPersistence() throws Exception {
+        startGrid(configuration(0, true, false))
+            .cluster().state(ACTIVE);
+
+        IgniteConfiguration clientCfg = configuration(1, true, true);
+
+        clientCfg.getDataStorageConfiguration()
+            .getDefaultDataRegionConfiguration()
+            .setPersistenceEnabled(false);
+
+        startGrid(clientCfg);
+
+        assertEquals("Unexpected cluster size", 2, grid(1).cluster().nodes().size());
+    }
 }