Nikolay Izhikov created IGNITE-15358:
----------------------------------------

             Summary: Client node can't reconnect to cluster with security 
enabled.
                 Key: IGNITE-15358
                 URL: https://issues.apache.org/jira/browse/IGNITE-15358
             Project: Ignite
          Issue Type: Improvement
            Reporter: Nikolay Izhikov


After IGNITE-15101 client node can't reconnect to the cluster because node id 
changed on the disconnect but security processor continues to use old node id.

{code:java}
public class ClientReconnectTest extends GridCommonAbstractTest {
    /** {@inheritDoc} */
    @Override protected IgniteConfiguration getConfiguration(String 
igniteInstanceName) throws Exception {
        return 
super.getConfiguration(igniteInstanceName).setPluginProviders(new 
TestReconnectSecurityPluginProvider() {
            /** {@inheritDoc} */
            @Override protected GridSecurityProcessor 
securityProcessor(GridKernalContext ctx) {
                return new TestReconnectProcessor(ctx) {
                    @Override public SecurityContext securityContext(UUID 
subjId) {
                        if (ctx.localNodeId().equals(subjId))
                            return ctx.security().securityContext();

                        throw new IgniteException(
                            "Unexpected subjId[subjId=" + subjId + 
",localNodeId=" + ctx.localNodeId() + ']'
                        );
                    }

                    @Override public SecurityContext 
authenticateNode(ClusterNode node, SecurityCredentials cred) {
                        return new TestSecurityContext(new 
TestSecuritySubject(node.id()));
                    }
                };
            }
        });
    }

    /** {@inheritDoc} */
    @Override protected void beforeTest() throws Exception {
        super.beforeTest();

        cleanPersistenceDir();
    }

    /** */
    @Test
    public void testClientNodeReconnected() throws Exception {
        IgniteEx ignite = startGrids(2);

        ignite.cluster().state(ClusterState.ACTIVE);

        int clientIdx = 2;

        IgniteEx ex = startClientGrid(clientIdx);

        CountDownLatch latch = new CountDownLatch(1);

        ex.events().localListen(evt -> {
            latch.countDown();

            return true;
        }, EVT_CLIENT_NODE_RECONNECTED);

        DiscoverySpi discoverySpi = ignite(0).configuration().getDiscoverySpi();

        discoverySpi.failNode(nodeId(clientIdx), null);

        assertTrue(latch.await(getTestTimeout(), TimeUnit.MILLISECONDS));
    }
}

{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to