Skip to content

Commit f9aef4a

Browse files
committed
Remove code_server_cache
It was introduced to fix a problem in a feature that's no longer used, so we remove both the feature and code_server_cache.
1 parent 4def1f9 commit f9aef4a

8 files changed

+6
-217
lines changed

deps/rabbit/src/code_server_cache.erl

Lines changed: 0 additions & 83 deletions
This file was deleted.

deps/rabbit/src/rabbit.erl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181

8282
-rabbit_boot_step({database,
8383
[{mfa, {rabbit_db, init, []}},
84-
{requires, code_server_cache},
84+
{requires, rabbit_registry},
8585
{enables, external_infrastructure}]}).
8686

8787
-rabbit_boot_step({networking_metadata_store,
@@ -96,12 +96,6 @@
9696
{requires, database},
9797
{enables, external_infrastructure}]}).
9898

99-
-rabbit_boot_step({code_server_cache,
100-
[{description, "code_server cache server"},
101-
{mfa, {rabbit_sup, start_child, [code_server_cache]}},
102-
{requires, rabbit_alarm},
103-
{enables, worker_pool}]}).
104-
10599
-rabbit_boot_step({worker_pool,
106100
[{description, "default worker pool"},
107101
{mfa, {rabbit_sup, start_supervisor_child,

deps/rabbit/src/rabbit_direct.erl

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
-export([list_local/0,
1717
conserve_resources/3]).
1818

19-
%% For testing only
20-
-export([extract_extra_auth_props/4]).
21-
2219
-include_lib("rabbit_common/include/rabbit.hrl").
2320
-include_lib("rabbit_common/include/rabbit_misc.hrl").
2421
-include_lib("kernel/include/logger.hrl").
@@ -85,7 +82,7 @@ auth_fun({Username, Password}, VHost, ExtraAuthProps) ->
8582
%% during the first authentication. However, we do have the outcome from such successful authentication.
8683

8784
connect(Creds, VHost, Protocol, Pid, Infos) ->
88-
ExtraAuthProps = append_authz_backends(extract_extra_auth_props(Creds, VHost, Pid, Infos), Infos),
85+
ExtraAuthProps = get_authz_backends(Infos),
8986

9087
AuthFun = auth_fun(Creds, VHost, ExtraAuthProps),
9188
case rabbit_boot_state:has_reached_and_is_active(core_started) of
@@ -119,37 +116,8 @@ connect(Creds, VHost, Protocol, Pid, Infos) ->
119116
false -> {error, broker_not_found_on_node}
120117
end.
121118

122-
extract_extra_auth_props(Creds, VHost, Pid, Infos) ->
123-
case extract_protocol(Infos) of
124-
undefined ->
125-
[];
126-
Protocol ->
127-
maybe_call_connection_info_module(Protocol, Creds, VHost, Pid, Infos)
128-
end.
129-
130-
131-
append_authz_backends(AuthProps, Infos) ->
132-
case proplists:get_value(authz_backends, Infos, undefined) of
133-
undefined -> AuthProps;
134-
AuthzBackends -> AuthProps ++ AuthzBackends
135-
end.
136-
137-
extract_protocol(Infos) ->
138-
case proplists:get_value(protocol, Infos, undefined) of
139-
{Protocol, _Version} ->
140-
Protocol;
141-
_ ->
142-
undefined
143-
end.
144-
145-
maybe_call_connection_info_module(Protocol, Creds, VHost, Pid, Infos) ->
146-
Module = rabbit_data_coercion:to_atom(string:to_lower(
147-
"rabbit_" ++
148-
lists:flatten(string:replace(rabbit_data_coercion:to_list(Protocol), " ", "_", all)) ++
149-
"_connection_info")
150-
),
151-
Args = [Creds, VHost, Pid, Infos],
152-
code_server_cache:maybe_call_mfa(Module, additional_authn_params, Args, []).
119+
get_authz_backends(Infos) ->
120+
proplists:get_value(authz_backends, Infos, []).
153121

154122
is_vhost_alive(VHost, {Username, _Password}, Pid) ->
155123
PrintedUsername = case Username of

deps/rabbit/test/rabbit_dummy_protocol_connection_info.erl

Lines changed: 0 additions & 19 deletions
This file was deleted.

deps/rabbit/test/rabbit_foo_protocol_connection_info.erl

Lines changed: 0 additions & 25 deletions
This file was deleted.

deps/rabbit/test/unit_access_control_SUITE.erl

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ groups() ->
3030
login_of_passwordless_user,
3131
set_tags_for_passwordless_user,
3232
change_password,
33-
auth_backend_internal_expand_topic_permission,
34-
rabbit_direct_extract_extra_auth_props
33+
auth_backend_internal_expand_topic_permission
3534
]}
3635
].
3736

@@ -221,28 +220,6 @@ set_tags_for_passwordless_user1(_Config) ->
221220
passed.
222221

223222

224-
rabbit_direct_extract_extra_auth_props(_Config) ->
225-
{ok, CSC} = code_server_cache:start_link(),
226-
% no protocol to extract
227-
[] = rabbit_direct:extract_extra_auth_props(
228-
{<<"guest">>, <<"guest">>}, <<"/">>, 1,
229-
[{name,<<"127.0.0.1:52366 -> 127.0.0.1:1883">>}]),
230-
% protocol to extract, but no module to call
231-
[] = rabbit_direct:extract_extra_auth_props(
232-
{<<"guest">>, <<"guest">>}, <<"/">>, 1,
233-
[{protocol, {'PROTOCOL_WITHOUT_MODULE', "1.0"}}]),
234-
% see rabbit_dummy_protocol_connection_info module
235-
% protocol to extract, module that returns a client ID
236-
[{client_id, <<"DummyClientId">>}] = rabbit_direct:extract_extra_auth_props(
237-
{<<"guest">>, <<"guest">>}, <<"/">>, 1,
238-
[{protocol, {'DUMMY_PROTOCOL', "1.0"}}]),
239-
% protocol to extract, but error thrown in module
240-
[] = rabbit_direct:extract_extra_auth_props(
241-
{<<"guest">>, <<"guest">>}, <<"/">>, -1,
242-
[{protocol, {'DUMMY_PROTOCOL', "1.0"}}]),
243-
gen_server:stop(CSC),
244-
ok.
245-
246223
auth_backend_internal_expand_topic_permission(_Config) ->
247224
ExpandMap = #{<<"username">> => <<"guest">>, <<"vhost">> => <<"default">>},
248225
%% simple case

deps/rabbit/test/unit_access_control_authn_authz_context_propagation_SUITE.erl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,11 @@ propagate_context_to_auth_backend1() ->
8383
password = <<"guest">>,
8484
adapter_info = #amqp_adapter_info{additional_info = [
8585
{variable_map, #{<<"key1">> => <<"value1">>}}
86-
],
87-
protocol = {'FOO_PROTOCOL', '1.0'} %% this will trigger a call to rabbit_foo_protocol_connection_info
86+
]
8887
}
8988
},
9089
{ok, Conn} = amqp_connection:start(AmqpParams),
9190

92-
%% rabbit_direct will call the rabbit_foo_protocol_connection_info module to extract information
93-
%% this information will be propagated to the authentication backend
94-
[{authentication, AuthProps}] = rabbit_auth_backend_context_propagation_mock:get(authentication),
95-
?assertEqual(<<"value1">>, proplists:get_value(key1, AuthProps)),
96-
9791
%% variable_map is propagated from rabbit_direct to the authorization backend
9892
[{vhost_access, AuthzData}] = rabbit_auth_backend_context_propagation_mock:get(vhost_access),
9993
?assertEqual(<<"value1">>, maps:get(<<"key1">>, AuthzData)),

deps/rabbitmq_stomp/src/rabbit_stomp_connection_info.erl

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)