rabbitmq/rabbitmq-erlang-client

Capability to access connection properties (direct connection)

Closed this issue · 2 comments

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 info_key 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?

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

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