Skip to content

Commit dc6d0e3

Browse files
dumbbellmergify[bot]
authored andcommitted
rabbit_access_control: Allow a testsuite to declare valid auth backend modules
[Why] rabbit_access_control checks that the auth backend module is provided by `rabbit` or an enabled plugin. Some testsuites use a local auth backend module for tests purpose that do not come as a plugin. We need a mechanism to allow that. [How] We introduce a new `test_auth_backends` application envoironment variable that testsuites can used to declare their valid auth backend modules. (cherry picked from commit 574ded4)
1 parent 39ca5b7 commit dc6d0e3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

deps/rabbit/src/rabbit_access_control.erl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ is_auth_backend_module_enabled(Mod) when is_atom(Mod) ->
141141
"it will be skipped during "
142142
"authentication/authorization",
143143
[Mod, PluginName]),
144-
false
144+
is_test_auth_backend_module(Mod)
145145
end;
146146
{error, no_provider} ->
147147
?LOG_INFO(
@@ -150,10 +150,14 @@ is_auth_backend_module_enabled(Mod) when is_atom(Mod) ->
150150
"module. Until then it will be skipped during "
151151
"authentication/authorization",
152152
[Mod]),
153-
false
153+
is_test_auth_backend_module(Mod)
154154
end
155155
end.
156156

157+
is_test_auth_backend_module(Mod) ->
158+
Mods = application:get_env(rabbit, test_auth_backends, []),
159+
lists:member(Mod, Mods).
160+
157161
-spec check_user_pass_login
158162
(rabbit_types:username(), rabbit_types:password()) ->
159163
{'ok', rabbit_types:user()} |

0 commit comments

Comments
 (0)