Does ActiveMQ Apollo implement JMSXUserID or something similar to help track authenticated users?

StackOverflow https://stackoverflow.com/questions/11059833

  •  14-06-2021
  •  | 
  •  

Вопрос

I know that ActiveMQ supports the JMSXUserID property:

http://activemq.apache.org/jmsxuserid.html

I'm trying to use Apollo (an ActiveMQ sub-project) instead of ActiveMQ, and at the moment I'm stuck trying to figure out to replicate that same behavior in Apollo.

I'm not picky about the mechanics, but in a nutshell I need some way to tag every incoming message from an authenticated user with an identifier that lets me know which user sent which message, but in a way that users can't spoof by setting themselves. This is basically exactly what JMSXUserID is used for by ActiveMQ, but I can't seem to figure out how to do the same thing in Apollo.

What am I missing?

I'm finding this especially difficult to Google for, since ActiveMQ links to Apollo on every single one of its pages so most of my search results are unhelpful.

Thanks in advance.

Это было полезно?

Решение

Apollo's user manual describes how you can configure apollo to automatically add a user header which is set to the sending user's id.

Basically you want to configure the connector's stomp protocol with something like:

<connector id="tcp" bind="tcp://0.0.0.0:61613">
  <stomp>
    <add_user_header separator=",">JMSXUserID</add_user_header>
  </stomp>
</connector>

Unfortunately the Openwire protocol does not support this yet. Issue APLO-213 is open to address it.

Другие советы

Does Apollo even support JMS?

from web page: http://activemq.apache.org/apollo/

In it’s current incarnation, Apollo only supports the STOMP protocol but just like the original ActiveMQ, it’s been designed to be a multi protocol broker. In future versions it will be adding OpenWire support so it can be compatible with ActiveMQ 5.x JMS clients.

To solve your very problem at hand, can't you simply add a header with the userid in the code?

Just grab it from the OS, say you are using Java, then you could perhaps use something like

System.getProperty("user.name") 

and attach it to a STOMP header. This is, however, an issue for the client lib (stomp library, if any is used) rather than the server itself.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top