Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
1740273
impl
Vladsz83 Jun 11, 2026
77910fa
Merge branch 'master' into IGNITE-28770-Introduce-a-operation-context…
Vladsz83 Jun 11, 2026
baa1473
in-progress
Vladsz83 Jun 12, 2026
9f8e09d
raw
Vladsz83 Jun 14, 2026
72b5c17
Merge branch 'master' into IGNITE-28770-Introduce-a-operation-context…
Vladsz83 Jun 15, 2026
9f4ccec
impl
Vladsz83 Jun 15, 2026
c73b97c
Merge branch 'master' into IGNITE-28770-Introduce-a-operation-context…
Vladsz83 Jun 16, 2026
1987030
review fixes
Vladsz83 Jun 17, 2026
d293eb0
fix
Vladsz83 Jun 17, 2026
1395caf
review fixes
Vladsz83 Jun 17, 2026
79dab0b
reimpol
Vladsz83 Jun 18, 2026
695f18d
review fixes
Vladsz83 Jun 19, 2026
f0d579f
review fixes
Vladsz83 Jun 19, 2026
13d5f11
renaming
Vladsz83 Jun 19, 2026
61ef963
Merge branch 'master' into IGNITE-28770-Introduce-a-operation-context…
Vladsz83 Jun 22, 2026
1bc5fa8
review fixes
Vladsz83 Jun 22, 2026
cb024d1
fix
Vladsz83 Jun 22, 2026
4f5d180
fix
Vladsz83 Jun 22, 2026
a25c2f2
review fixes
Vladsz83 Jun 22, 2026
4af4ccd
typo
Vladsz83 Jun 22, 2026
f863cc4
typo
Vladsz83 Jun 22, 2026
0e2fcd7
trivial
Vladsz83 Jun 22, 2026
3d7a8bd
raw
Vladsz83 Jun 23, 2026
c545034
txt
Vladsz83 Jun 23, 2026
8875351
fix
Vladsz83 Jun 23, 2026
41d5e1f
fix
Vladsz83 Jun 23, 2026
ec3b241
fix
Vladsz83 Jun 23, 2026
69b5916
fix
Vladsz83 Jun 23, 2026
2f1cf8d
fix
Vladsz83 Jun 23, 2026
33bb3a8
fix
Vladsz83 Jun 23, 2026
47aac3e
fix
Vladsz83 Jun 23, 2026
7d2778b
revert
Vladsz83 Jun 23, 2026
1858db5
review comment fix
Vladsz83 Jun 23, 2026
a0ed08a
minor style fix
Vladsz83 Jun 23, 2026
b034a48
Merge branch 'IGNITE-28770-Introduce-a-operation-context-attributes-r…
Vladsz83 Jun 23, 2026
b147380
raw
Vladsz83 Jun 23, 2026
68615dc
raw
Vladsz83 Jun 23, 2026
3876075
Merge branch 'refs/heads/master' into IGNITE-28808-Disallow-creation-…
Vladsz83 Jun 23, 2026
6b03860
raw
Vladsz83 Jun 24, 2026
65348ca
raw
Vladsz83 Jun 24, 2026
91a65a1
fixes
Vladsz83 Jun 24, 2026
2884487
fix
Vladsz83 Jun 24, 2026
915cfd5
review fixes
Vladsz83 Jun 25, 2026
48d9dcf
renaming
Vladsz83 Jun 25, 2026
927ea03
Merge branch 'master' into IGNITE-28808-Disallow-creation-of-operatio…
Vladsz83 Jun 25, 2026
4fb30a5
fixes
Vladsz83 Jun 25, 2026
048ed2f
test refactoring
Vladsz83 Jun 25, 2026
5cee094
javadoc
Vladsz83 Jun 25, 2026
9190461
minor coding
Vladsz83 Jun 25, 2026
d570302
raw
Vladsz83 Jun 25, 2026
4952235
Merge branch 'master' into Replace-SecurityAwareCustomMessageWrapper-…
Vladsz83 Jun 26, 2026
0955e65
raw
Vladsz83 Jun 26, 2026
e1d7832
test fixes
Vladsz83 Jun 26, 2026
3eb7f8c
reimpl
Vladsz83 Jun 26, 2026
352c048
fix
Vladsz83 Jun 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.apache.ignite.internal.managers.deployment.GridDeploymentInfoBean;
import org.apache.ignite.internal.managers.deployment.GridDeploymentRequest;
import org.apache.ignite.internal.managers.deployment.GridDeploymentResponse;
import org.apache.ignite.internal.managers.discovery.SecurityAwareCustomMessageWrapper;
import org.apache.ignite.internal.managers.encryption.ChangeCacheEncryptionRequest;
import org.apache.ignite.internal.managers.encryption.EncryptionDataBagItem;
import org.apache.ignite.internal.managers.encryption.GenerateEncryptionKeyRequest;
Expand Down Expand Up @@ -239,6 +238,7 @@
import org.apache.ignite.internal.processors.rollingupgrade.RollingUpgradeNodeData;
import org.apache.ignite.internal.processors.rollingupgrade.feature.IgniteFeatureSet;
import org.apache.ignite.internal.processors.rollingupgrade.feature.IgniteProductFeatures;
import org.apache.ignite.internal.processors.security.SecurityContextImpl;
import org.apache.ignite.internal.processors.service.ServiceChangeBatchRequest;
import org.apache.ignite.internal.processors.service.ServiceClusterDeploymentResult;
import org.apache.ignite.internal.processors.service.ServiceClusterDeploymentResultBatch;
Expand Down Expand Up @@ -437,7 +437,7 @@ public CoreMessagesProvider(Marshaller dfltMarsh, Marshaller schemaAwareMarsh, C
withNoSchema(FullMessage.class);
withNoSchema(InitMessage.class);
withNoSchema(CacheStatisticsModeChangeMessage.class);
withNoSchema(SecurityAwareCustomMessageWrapper.class);
++msgIdx; // Former SecurityAwareCustomMessageWrapper
withNoSchema(MetadataRemoveAcceptedMessage.class);
withNoSchema(MetadataRemoveProposedMessage.class);
withNoSchema(WalStateFinishMessage.class);
Expand Down Expand Up @@ -606,7 +606,9 @@ public CoreMessagesProvider(Marshaller dfltMarsh, Marshaller schemaAwareMarsh, C
// [11500 - 11600]: IO, networking messages.
msgIdx = NODE_ID_MSG_TYPE;
withNoSchema(NodeIdMessage.class);
msgIdx = HANDSHAKE_MSG_TYPE;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor reliability fix. Wanted to bring long ago.

withNoSchema(HandshakeMessage.class);
msgIdx = HANDSHAKE_WAIT_MSG_TYPE;
withNoSchema(HandshakeWaitMessage.class);
withNoSchema(GridIoMessage.class);
withNoSchema(IgniteIoTestMessage.class);
Expand Down Expand Up @@ -688,9 +690,10 @@ public CoreMessagesProvider(Marshaller dfltMarsh, Marshaller schemaAwareMarsh, C
// [13400 - 13500]: Operation context messages.
msgIdx = 13400;
withNoSchema(OperationContextMessage.class);
withNoSchema(SecurityContextImpl.class);

// [13500 - 13600]: Rolling Upgrade messages.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We kept a 100-numbers-space earlier.

msgIdx = 13500;
// [13600 - 13700]: Rolling Upgrade messages.
msgIdx = 13600;
withNoSchema(IgniteFeatureSet.class);
withNoSchema(IgniteProductFeatures.class);
withNoSchema(RollingUpgradeNodeData.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@
import org.apache.ignite.internal.processors.cluster.ChangeGlobalStateMessage;
import org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState;
import org.apache.ignite.internal.processors.cluster.IGridClusterStateProcessor;
import org.apache.ignite.internal.processors.security.IgniteSecurity;
import org.apache.ignite.internal.processors.security.IgniteSecurityProcessor;
import org.apache.ignite.internal.processors.security.SecurityContext;
import org.apache.ignite.internal.processors.security.SecurityContextImpl;
import org.apache.ignite.internal.processors.tracing.messages.SpanContainer;
import org.apache.ignite.internal.systemview.ClusterNodeViewWalker;
import org.apache.ignite.internal.systemview.NodeAttributeViewWalker;
Expand Down Expand Up @@ -134,7 +135,6 @@
import org.apache.ignite.spi.discovery.DiscoveryMetricsProvider;
import org.apache.ignite.spi.discovery.DiscoveryNotification;
import org.apache.ignite.spi.discovery.DiscoverySpi;
import org.apache.ignite.spi.discovery.DiscoverySpiCustomMessage;
import org.apache.ignite.spi.discovery.DiscoverySpiDataExchange;
import org.apache.ignite.spi.discovery.DiscoverySpiHistorySupport;
import org.apache.ignite.spi.discovery.DiscoverySpiListener;
Expand Down Expand Up @@ -226,7 +226,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
};

/** Discovery cached history size. */
private final int DISCOVERY_HISTORY_SIZE = getInteger(IGNITE_DISCOVERY_HISTORY_SIZE, DFLT_DISCOVERY_HISTORY_SIZE);
private static final int DISCOVERY_HISTORY_SIZE = getInteger(IGNITE_DISCOVERY_HISTORY_SIZE, DFLT_DISCOVERY_HISTORY_SIZE);

/** */
private final Object discoEvtMux = new Object();
Expand Down Expand Up @@ -929,12 +929,10 @@ public SecurityAwareNotificationTask(DiscoveryNotification notification) {

/** */
@Override public void run() {
DiscoverySpiCustomMessage customMsg = notification.customMessage();
SecurityContextImpl secCtxMsg = OperationContext.get(IgniteSecurityProcessor.SEC_CTX_ATTR);

if (customMsg instanceof SecurityAwareCustomMessageWrapper) {
UUID secSubjId = ((SecurityAwareCustomMessageWrapper)customMsg).securitySubjectId();

try (Scope ignored = ctx.security().withContext(secSubjId)) {
if (secCtxMsg != null) {
try (Scope ignored = ctx.security().withContext(secCtxMsg.subjId)) {
super.run();
}
}
Expand Down Expand Up @@ -2339,12 +2337,13 @@ public GridFutureAdapter<DiscoveryLocalJoinData> localJoinFuture() {
* @throws IgniteCheckedException If failed.
*/
public void sendCustomEvent(DiscoveryCustomMessage msg) throws IgniteCheckedException {
try {
IgniteSecurity security = ctx.security();
UUID secSubjId = ctx.security().enabled() ? ctx.security().securityContext().subject().id() : null;

getSpi().sendCustomEvent(security.enabled()
? new SecurityAwareCustomMessageWrapper(msg, security.securityContext().subject().id())
: msg);
try (Scope ignored = secSubjId == null
? Scope.NOOP_SCOPE
: OperationContext.set(IgniteSecurityProcessor.SEC_CTX_ATTR, new SecurityContextImpl(secSubjId))
) {
getSpi().sendCustomEvent(msg);
}
catch (IgniteClientDisconnectedException e) {
IgniteFuture<?> reconnectFut = ctx.cluster().clientReconnectFuture();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.ignite.internal.processors.authentication;

import java.io.Serializable;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -57,12 +56,12 @@
import org.apache.ignite.internal.processors.security.GridSecurityProcessor;
import org.apache.ignite.internal.processors.security.IgniteSecurityProcessor;
import org.apache.ignite.internal.processors.security.SecurityContext;
import org.apache.ignite.internal.processors.security.SecurityContextImpl;
import org.apache.ignite.internal.thread.pool.IgniteThreadPoolExecutor;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
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;
import org.apache.ignite.lang.IgniteFuture;
Expand All @@ -73,7 +72,6 @@
import org.apache.ignite.plugin.security.SecurityException;
import org.apache.ignite.plugin.security.SecurityPermission;
import org.apache.ignite.plugin.security.SecuritySubject;
import org.apache.ignite.plugin.security.SecuritySubjectType;
import org.apache.ignite.spi.discovery.DiscoveryDataBag;
import org.apache.ignite.spi.discovery.DiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
Expand Down Expand Up @@ -1302,7 +1300,7 @@ private RefreshUsersStorageWorker(ArrayList<User> usrs) {
}

/** {@inheritDoc} */
@Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException {
@Override protected void body() {
if (ctx.clientNode())
return;

Expand Down Expand Up @@ -1331,74 +1329,4 @@ private RefreshUsersStorageWorker(ArrayList<User> usrs) {
}
}
}

/** Represents {@link SecuritySubject} implementation. */
private static class SecuritySubjectImpl implements SecuritySubject {
/** */
private static final long serialVersionUID = 0L;

/** Security subject identifier. */
private final UUID id;

/** Security subject login. */
private final String login;

/** Security subject type. */
private final SecuritySubjectType type;

/** Security subject address. */
private final InetSocketAddress addr;

/** */
public SecuritySubjectImpl(UUID id, String login, SecuritySubjectType type, InetSocketAddress addr) {
this.id = id;
this.login = login;
this.type = type;
this.addr = addr;
}

/** {@inheritDoc} */
@Override public UUID id() {
return id;
}

/** {@inheritDoc} */
@Override public String login() {
return login;
}

/** {@inheritDoc} */
@Override public SecuritySubjectType type() {
return type;
}

/** {@inheritDoc} */
@Override public InetSocketAddress address() {
return addr;
}

/** {@inheritDoc} */
@Override public String toString() {
return S.toString(SecuritySubjectImpl.class, this);
}
}

/** Represents {@link SecurityContext} implementation that ignores any security permission checks. */
private static class SecurityContextImpl implements SecurityContext, Serializable {
/** */
private static final long serialVersionUID = 0L;

/** */
private final SecuritySubject subj;

/** */
public SecurityContextImpl(UUID id, String login, SecuritySubjectType type, InetSocketAddress addr) {
subj = new SecuritySubjectImpl(id, login, type, addr);
}

/** {@inheritDoc} */
@Override public SecuritySubject subject() {
return subj;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ static boolean hasSandboxedNodes() {
return SANDBOXED_NODES_COUNTER.get() > 0;
}

/** Context attribute that holds Security Context. */
private static final OperationContextAttribute<SecurityContext> SEC_CTX = OperationContextAttribute.newInstance();
/** Attribute that holds local and distributed Security Context. */
public static final OperationContextAttribute<SecurityContextImpl> SEC_CTX_ATTR = OperationContextAttribute.newInstance();

/** Security processor. */
private final GridSecurityProcessor secPrc;
Expand Down Expand Up @@ -126,7 +126,7 @@ public IgniteSecurityProcessor(GridKernalContext ctx, GridSecurityProcessor secP

/** {@inheritDoc} */
@Override public Scope withContext(SecurityContext secCtx) {
return OperationContext.set(SEC_CTX, secCtx == dfltSecCtx ? null : secCtx);
return OperationContext.set(SEC_CTX_ATTR, secCtx == dfltSecCtx ? null : SecurityContextImpl.of(secCtx));
}

/** {@inheritDoc} */
Expand Down Expand Up @@ -172,12 +172,12 @@ public IgniteSecurityProcessor(GridKernalContext ctx, GridSecurityProcessor secP

/** {@inheritDoc} */
@Override public boolean isDefaultContext() {
return OperationContext.get(SEC_CTX) == null;
return OperationContext.get(SEC_CTX_ATTR) == null;
}

/** {@inheritDoc} */
@Override public SecurityContext securityContext() {
SecurityContext res = OperationContext.get(SEC_CTX);
SecurityContext res = OperationContext.get(SEC_CTX_ATTR);

return res == null ? dfltSecCtx : res;
}
Expand Down Expand Up @@ -236,6 +236,8 @@ public IgniteSecurityProcessor(GridKernalContext ctx, GridSecurityProcessor secP
@Override public void start() throws IgniteCheckedException {
super.start();

ctx.operationContextDispatcher().registerDistributedAttribute(0, SEC_CTX_ATTR);

ctx.addNodeAttribute(ATTR_GRID_SEC_PROC_CLASS, secPrc.getClass().getName());

secPrc.start();
Expand Down
Loading
Loading