@@ -46,9 +46,17 @@ user_login_authentication(Username, AuthProps) ->
46
46
Other -> {error , {bad_response , Other }}
47
47
end .
48
48
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.
52
60
resolveUsingPersistedCredentials (AuthProps ) ->
53
61
case proplists :get_value (rabbit_auth_backend_http , AuthProps , none ) of
54
62
none -> case proplists :get_value (rabbit_auth_backend_cache , AuthProps , none ) of
@@ -67,7 +75,7 @@ is_internal_property(rabbit_auth_backend_cache) -> true;
67
75
is_internal_property (_Other ) -> false .
68
76
69
77
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 )],
71
79
case PublicAuthProps of
72
80
[] -> resolveUsingPersistedCredentials (AuthProps );
73
81
_ -> PublicAuthProps
0 commit comments