Skip to content

Commit 7c89461

Browse files
Merge pull request #8492 from rabbitmq/mergify/bp/v3.10.x/pr-8490
Fix SASL external authentication in stream plugin (backport #8488) (backport #8489) (backport #8490)
2 parents b4aa4e6 + 798252c commit 7c89461

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

deps/rabbitmq_stream/src/rabbit_stream_reader.erl

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
%% client port
6060
peer_port,
6161
auth_mechanism,
62+
authentication_state :: any(),
6263
connected_at :: integer(),
6364
helper_sup :: pid(),
6465
socket :: rabbit_net:socket(),
@@ -70,7 +71,6 @@
7071
stream_leaders :: #{stream() => pid()},
7172
stream_subscriptions :: #{stream() => [subscription_id()]},
7273
credits :: atomics:atomics_ref(),
73-
authentication_state :: atom(),
7474
user :: undefined | #user{},
7575
virtual_host :: undefined | binary(),
7676
connection_step ::
@@ -1188,8 +1188,6 @@ handle_frame_pre_auth(Transport,
11881188
ServerProperties}}),
11891189
send(Transport, S, Frame),
11901190
{Connection#stream_connection{client_properties = ClientProperties,
1191-
authentication_state =
1192-
peer_properties_exchanged,
11931191
connection_step = peer_properties_exchanged},
11941192
State};
11951193
handle_frame_pre_auth(Transport,
@@ -1252,13 +1250,8 @@ handle_frame_pre_auth(Transport,
12521250
{C1#stream_connection{connection_step = failure},
12531251
{sasl_authenticate, ?RESPONSE_SASL_ERROR, <<>>}};
12541252
{challenge, Challenge, AuthState1} ->
1255-
rabbit_core_metrics:auth_attempt_succeeded(RemoteAddress,
1256-
<<>>,
1257-
stream),
1258-
{C1#stream_connection{authentication_state =
1259-
AuthState1,
1260-
connection_step =
1261-
authenticating},
1253+
{C1#stream_connection{authentication_state = AuthState1,
1254+
connection_step = authenticating},
12621255
{sasl_authenticate, ?RESPONSE_SASL_CHALLENGE,
12631256
Challenge}};
12641257
{ok, User = #user{username = Username}} ->
@@ -1275,11 +1268,9 @@ handle_frame_pre_auth(Transport,
12751268
[],
12761269
C1,
12771270
State),
1278-
{C1#stream_connection{authentication_state =
1279-
done,
1280-
user = User,
1281-
connection_step =
1282-
authenticated},
1271+
{C1#stream_connection{user = User,
1272+
authentication_state = done,
1273+
connection_step = authenticated},
12831274
{sasl_authenticate, ?RESPONSE_CODE_OK,
12841275
<<>>}};
12851276
not_allowed ->

0 commit comments

Comments
 (0)