Skip to content

Commit 122aa2d

Browse files
MarcialRosalesmergify[bot]
authored andcommitted
Improve docs wording
(cherry picked from commit 04658fb)
1 parent 20bc48c commit 122aa2d

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

deps/rabbitmq_auth_backend_http/src/rabbit_auth_backend_http.erl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
5260
resolveUsingPersistedCredentials(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;
6775
is_internal_property(_Other) -> false.
6876

6977
extractOtherCredentials(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

Comments
 (0)