Pass data between BrokerFilter methods?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Pass data between BrokerFilter methods?

booya127
I have developed a custom BrokerPlugin using BrokerFilter for Security purposes.
The plugin performs its own custom authentication in the addConnection() method.
During the authentication we return an authorization parameter(String) that allows
us to identify which topic(s) a client is allowed to subscribe. In the addConsumer()
method we determine whether or not a client is allowed to subscribe to a topic
based on our own search rules using the parameter from the the custom authentication.
Therefore, I need to be able to stash the authorization parameter from the custom
authentication in the addConnection() method so it will be there for addConsumer() method.
I had thought I could stash it in the ConnectionContext class, but setUserName() method
is protected (not public). I ended up using a HashMap that uses the ConnectionId as the
key and store the parameter in the map. Is there a better way to solve the problem than
using a HashMap? And is there a way that I can use the ConnectionContext class or any
other Class?