rabbitmq / rabbitmq-erlang-client

Erlang client for RabbitMQ
https://www.rabbitmq.com/
Other
184 stars 127 forks source link

Capability to access connection properties (direct connection) #52

Closed tiagodeoliveira closed 5 years ago

tiagodeoliveira commented 8 years ago

The amqp_connection returns a bunch of information about connection itself, but in some cases there is the need to get even more information that is returned using info keys. Using the _infokey user for instance, it will return filtered information about the user: i(user, #state{params = P}) -> P#amqp_params_direct.username;

The problem is that the direct connection returns much more info about the user, like Tags generated during authentication process. The idea is to create a way to allow user to access the entire content from connection state, with something like: i(state, State) -> State;

The main use, on my case, is to allow mqtt plugin to execute check_topic_access without having to execute user_authentication multiple times.

What do you guys think?

hairyhum commented 8 years ago

For this specific use case, there can be just one additional info item (e.g. internal_user) to report internal user representation.

tiagodeoliveira commented 8 years ago

Perfect, I'll do the PR. Thanks a bunch @hairyhum.