Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
timoninmaxim committed Nov 14, 2024
1 parent 0f93a5c commit 9b0c2c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1877,13 +1877,7 @@ private void unwindMessageSet(GridCommunicationMessageSet msgSet, GridMessageLis
* @param msg Message.
* @param secSubjId Security subject that will be used to open a security session.
*/
private void invokeListener(
Byte plc,
GridMessageListener lsnr,
UUID nodeId,
Object msg,
UUID secSubjId
) {
private void invokeListener(Byte plc, GridMessageListener lsnr, UUID nodeId, Object msg, UUID secSubjId) {
MTC.span().addLog(() -> "Invoke listener");

Byte oldPlc = CUR_PLC.get();
Expand All @@ -1895,14 +1889,9 @@ private void invokeListener(

UUID newSecSubjId = secSubjId != null ? secSubjId : nodeId;

try (
OperationSecurityContext ignored = ctx.security().withContext(newSecSubjId);
) {
try (OperationSecurityContext ignored = ctx.security().withContext(newSecSubjId)) {
lsnr.onMessage(nodeId, msg, plc);
}
catch (Exception e) {
throw new IgniteException("Failed to close SessionContext", e);
}
finally {
if (change)
CUR_PLC.set(oldPlc);
Expand Down Expand Up @@ -2134,12 +2123,10 @@ private long getInverseConnectionWaitTimeout() {
long timeout,
boolean skipOnTimeout
) {
boolean secEnabled = ctx.security().enabled();

if (secEnabled) {
if (ctx.security().enabled()) {
UUID secSubjId = null;

if (secEnabled && !ctx.security().isDefaultContext())
if (!ctx.security().isDefaultContext())
secSubjId = ctx.security().securityContext().subject().id();

return new GridIoSecurityAwareMessage(secSubjId, plc, topic, topicOrd, msg, ordered, timeout, skipOnTimeout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
import org.jetbrains.annotations.Nullable;

/**
*
Expand Down Expand Up @@ -74,7 +73,7 @@ public GridIoSecurityAwareMessage(
/**
* @return Security subject id.
*/
@Nullable UUID secSubjId() {
UUID secSubjId() {
return secSubjId;
}

Expand Down Expand Up @@ -132,6 +131,7 @@ public GridIoSecurityAwareMessage(
return false;

reader.incrementState();

}

return reader.afterMessageRead(GridIoSecurityAwareMessage.class);
Expand Down

0 comments on commit 9b0c2c8

Please sign in to comment.