Source:
<code>@Override public @Nullable IgniteNodeValidationResult validateNode( ClusterNode node, JoiningNodeDiscoveryData discoData ) { if(!cachesInfo.isMergeConfigSupports(node)) return null; if (discoData.hasJoiningNodeData() && discoData.joiningNodeData() instanceof CacheJoinNodeDiscoveryData) { CacheJoinNodeDiscoveryData nodeData = (CacheJoinNodeDiscoveryData)discoData.joiningNodeData(); boolean isGridActive = ctx.state().clusterState().active(); StringBuilder errorMsg = new StringBuilder(); SecurityContext secCtx = null; if (ctx.security().enabled()) { try { secCtx = nodeSecurityContext(marsh, U.resolveClassLoader(ctx.config()), node); } catch (SecurityException se) { errorMsg.append(se.getMessage()); } } for (CacheJoinNodeDiscoveryData.CacheInfo cacheInfo : nodeData.caches().values()) { if (secCtx != null && cacheInfo.cacheType() == CacheType.USER) { <START> try (IgniteSecuritySession s = ctx.security().startSession(secCtx)) { <END> authorizeCacheCreate(cacheInfo.cacheData().config()); } catch (SecurityException ex) { if (errorMsg.length() > 0) errorMsg.append("\n"); errorMsg.append(ex.getMessage()); } } DynamicCacheDescriptor localDesc = cacheDescriptor(cacheInfo.cacheData().config().getName()); if (localDesc == null) continue; QuerySchemaPatch schemaPatch = localDesc.makeSchemaPatch(cacheInfo.cacheData().queryEntities()); if (schemaPatch.hasConflicts() || (isGridActive && !schemaPatch.isEmpty())) { if (errorMsg.length() > 0) errorMsg.append("\n"); if (schemaPatch.hasConflicts()) errorMsg.append(String.format(MERGE_OF_CONFIG_CONFLICTS_MESSAGE, localDesc.cacheName(), schemaPatch.getConflictsMessage())); else errorMsg.append(String.format(MERGE_OF_CONFIG_REQUIRED_MESSAGE, localDesc.cacheName())); } } if (errorMsg.length() > 0) { String msg = errorMsg.toString(); return new IgniteNodeValidationResult(node.id(), msg, msg); } } return null; }</code><technical_language>start SecuritySession(on demand) for other caches checks</technical_language>

Target:
@Override public @Nullable IgniteNodeValidationResult validateNode( ClusterNode node, JoiningNodeDiscoveryData discoData ) { if(!cachesInfo.isMergeConfigSupports(node)) return null; if (discoData.hasJoiningNodeData() && discoData.joiningNodeData() instanceof CacheJoinNodeDiscoveryData) { CacheJoinNodeDiscoveryData nodeData = (CacheJoinNodeDiscoveryData)discoData.joiningNodeData(); boolean isGridActive = ctx.state().clusterState().active(); StringBuilder errorMsg = new StringBuilder(); SecurityContext secCtx = null; if (ctx.security().enabled()) { try { secCtx = nodeSecurityContext(marsh, U.resolveClassLoader(ctx.config()), node); } catch (SecurityException se) { errorMsg.append(se.getMessage()); } } for (CacheJoinNodeDiscoveryData.CacheInfo cacheInfo : nodeData.caches().values()) { if (secCtx != null && cacheInfo.cacheType() == CacheType.USER) { try (OperationSecurityContext s = ctx.security().withContext(secCtx)) { authorizeCacheCreate(cacheInfo.cacheData().config()); } catch (SecurityException ex) { if (errorMsg.length() > 0) errorMsg.append("\n"); errorMsg.append(ex.getMessage()); } } DynamicCacheDescriptor localDesc = cacheDescriptor(cacheInfo.cacheData().config().getName()); if (localDesc == null) continue; QuerySchemaPatch schemaPatch = localDesc.makeSchemaPatch(cacheInfo.cacheData().queryEntities()); if (schemaPatch.hasConflicts() || (isGridActive && !schemaPatch.isEmpty())) { if (errorMsg.length() > 0) errorMsg.append("\n"); if (schemaPatch.hasConflicts()) errorMsg.append(String.format(MERGE_OF_CONFIG_CONFLICTS_MESSAGE, localDesc.cacheName(), schemaPatch.getConflictsMessage())); else errorMsg.append(String.format(MERGE_OF_CONFIG_REQUIRED_MESSAGE, localDesc.cacheName())); } } if (errorMsg.length() > 0) { String msg = errorMsg.toString(); return new IgniteNodeValidationResult(node.id(), msg, msg); } } return null; }