@@ -46,9 +46,17 @@ user_login_authentication(Username, AuthProps) ->
4646 Other -> {error , {bad_response , Other }}
4747 end .
4848
49- % % Credentials (e.g. password) maybe directly in the password attribute in AuthProps
50- % % or as a Function with the attribute rabbit_auth_backend_http if the user was already authenticated with http backend
51- % % or as a Function with the attribute rabbit_auth_backend_cache if the user was already authenticated via cache backend
49+ % % When some protocols, such as MQTT, uses an internal AMQP client, to interact with RabbitMQ core,
50+ % % it happens that the main protocol authenticates the user passing all credentials (e.g. password, client_id, vhost)
51+ % % however the internal AMQP client also performs further authentications. THe latter authentication
52+ % % attempt lacks of all credentials. Instead those credentials are persisted behind a function call
53+ % % that returns an AuthProps.
54+ % % If the user was first authenticated by rabbit_auth_backend_http, there will be one property called
55+ % % `rabbit_auth_backend_http` whose value is a function that returns a proplist with all the credentials used
56+ % % on the first successful login.
57+ % % However, it may happen that the user was authenticated via rabbit_auth_backend_cache, in that case,
58+ % % the property `rabbit_auth_backend_cache` is a function which returns a proplist with all the credentials used
59+ % % on the first succcessful login.
5260resolveUsingPersistedCredentials (AuthProps ) ->
5361 case proplists :get_value (rabbit_auth_backend_http , AuthProps , none ) of
5462 none -> case proplists :get_value (rabbit_auth_backend_cache , AuthProps , none ) of
@@ -67,7 +75,7 @@ is_internal_property(rabbit_auth_backend_cache) -> true;
6775is_internal_property (_Other ) -> false .
6876
6977extractOtherCredentials (AuthProps ) ->
70- PublicAuthProps = [{K ,V } || {K ,V } <- AuthProps , not is_internal_property (K )],
78+ PublicAuthProps = [{K ,V } || {K ,V } <- AuthProps , not is_internal_property (K )],
7179 case PublicAuthProps of
7280 [] -> resolveUsingPersistedCredentials (AuthProps );
7381 _ -> PublicAuthProps
0 commit comments