Wildfly ContextService 并发 securityIdentity 为空

Wildfly ContextService concurrent securityIdentity is null

我正在尝试通过队列发送对象。该对象包装在 ContextService 的 createContextualProxy 中。但是,如果我打开对象,则 securityIdentity 为空。该对象是正确的代理。

发件人:

@Resource(name = "DefaultContextService")
private ContextService cs;

public void sendMessage() {
    ObjectMessage objectMessage = context.createObjectMessage();
    objectMessage.setObject((Serializable) cs.createContextualProxy(<ObjectToSend>, 
            Runnable.class));            
    context.createProducer().send(queue, objectMessage);
}

接收者:

ObjectMessage message = (ObjectMessage) msg;                
Runnable myObject = (Runnable) message.getObject();
myObject.run();

可运行的 myObject 是一个代理。但是 securityIdentity=null.

以前有人遇到过这个问题吗?

执行此操作的唯一方法是将用户的安全身份直接合并到您要发送的对象中。

安全上下文信息未保留在上下文代理中,因为 WildFly(最高 15.0.1)已损坏。

JMS 要求 ObjectMessage 负载是可序列化的。然而,安全身份对象保留在代理中(org.wildfly.security.auth.server.SecurityIdentity object) is not Serializable, so it is declared transient in the org.jboss.as.ee.concurrent.IdentityAwareProxyInvocationHandler 代理实现。

因此它无法在后续的 JMS 消息 serialisation/deserialization 进程中存活。

有一个旧的WildFly issue已经关闭了,但是我知道从那时起安全实现已经完全被替换了...