|
@@ -75,9 +75,14 @@ end_per_testcase(_TestCase, _Config) ->
|
|
|
%%------------------------------------------------------------------------------
|
|
%%------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
t_run_case(Config) ->
|
|
t_run_case(Config) ->
|
|
|
|
|
+ run_case(Config, true),
|
|
|
|
|
+ run_case(Config, false),
|
|
|
|
|
+ run_case(Config, auto).
|
|
|
|
|
+
|
|
|
|
|
+run_case(Config, UseLegazyProtocol) ->
|
|
|
Case = ?config(test_case, Config),
|
|
Case = ?config(test_case, Config),
|
|
|
ok = setup_source_data(Case),
|
|
ok = setup_source_data(Case),
|
|
|
- ok = setup_authz_source(Case),
|
|
|
|
|
|
|
+ ok = setup_authz_source(Case#{use_legacy_protocol => UseLegazyProtocol}),
|
|
|
ok = emqx_authz_test_lib:run_checks(Case).
|
|
ok = emqx_authz_test_lib:run_checks(Case).
|
|
|
|
|
|
|
|
%%------------------------------------------------------------------------------
|
|
%%------------------------------------------------------------------------------
|
|
@@ -374,10 +379,11 @@ setup_source_data(#{records := Records}) ->
|
|
|
{{true, _}, _} = mc_worker_api:insert(?MONGO_CLIENT, <<"acl">>, Records),
|
|
{{true, _}, _} = mc_worker_api:insert(?MONGO_CLIENT, <<"acl">>, Records),
|
|
|
ok.
|
|
ok.
|
|
|
|
|
|
|
|
-setup_authz_source(#{filter := Filter}) ->
|
|
|
|
|
|
|
+setup_authz_source(#{filter := Filter, use_legacy_protocol := UseLegazyProtocol}) ->
|
|
|
setup_config(
|
|
setup_config(
|
|
|
#{
|
|
#{
|
|
|
- <<"filter">> => Filter
|
|
|
|
|
|
|
+ <<"filter">> => Filter,
|
|
|
|
|
+ <<"use_legacy_protocol">> => UseLegazyProtocol
|
|
|
}
|
|
}
|
|
|
).
|
|
).
|
|
|
|
|
|
|
@@ -401,7 +407,8 @@ raw_mongo_authz_config() ->
|
|
|
<<"username">> => mongo_username(),
|
|
<<"username">> => mongo_username(),
|
|
|
<<"password">> => mongo_password(),
|
|
<<"password">> => mongo_password(),
|
|
|
|
|
|
|
|
- <<"filter">> => #{<<"username">> => <<"${username}">>}
|
|
|
|
|
|
|
+ <<"filter">> => #{<<"username">> => <<"${username}">>},
|
|
|
|
|
+ <<"use_legacy_protocol">> => <<"auto">>
|
|
|
}.
|
|
}.
|
|
|
|
|
|
|
|
mongo_server() ->
|
|
mongo_server() ->
|