Skip to content

Commit a9a32e9

Browse files
authored
Merge pull request #8490 from rabbitmq/mergify/bp/v3.11.x/pr-8489
Fix SASL external authentication in stream plugin (backport #8488) (backport #8489)
2 parents 2023a3c + 7ab9cb0 commit a9a32e9

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
@@ -64,6 +64,7 @@
6464
%% client port
6565
peer_port,
6666
auth_mechanism,
67+
authentication_state :: any(),
6768
connected_at :: integer(),
6869
helper_sup :: pid(),
6970
socket :: rabbit_net:socket(),
@@ -75,7 +76,6 @@
7576
stream_leaders :: #{stream() => pid()},
7677
stream_subscriptions :: #{stream() => [subscription_id()]},
7778
credits :: atomics:atomics_ref(),
78-
authentication_state :: atom(),
7979
user :: undefined | #user{},
8080
virtual_host :: undefined | binary(),
8181
connection_step ::
@@ -1371,8 +1371,6 @@ handle_frame_pre_auth(Transport,
13711371
ServerProperties}}),
13721372
send(Transport, S, Frame),
13731373
{Connection#stream_connection{client_properties = ClientProperties,
1374-
authentication_state =
1375-
peer_properties_exchanged,
13761374
connection_step = peer_properties_exchanged},
13771375
State};
13781376
handle_frame_pre_auth(Transport,
@@ -1435,13 +1433,8 @@ handle_frame_pre_auth(Transport,
14351433
{C1#stream_connection{connection_step = failure},
14361434
{sasl_authenticate, ?RESPONSE_SASL_ERROR, <<>>}};
14371435
{challenge, Challenge, AuthState1} ->
1438-
rabbit_core_metrics:auth_attempt_succeeded(RemoteAddress,
1439-
<<>>,
1440-
stream),
1441-
{C1#stream_connection{authentication_state =
1442-
AuthState1,
1443-
connection_step =
1444-
authenticating},
1436+
{C1#stream_connection{authentication_state = AuthState1,
1437+
connection_step = authenticating},
14451438
{sasl_authenticate, ?RESPONSE_SASL_CHALLENGE,
14461439
Challenge}};
14471440
{ok, User = #user{username = Username}} ->
@@ -1458,11 +1451,9 @@ handle_frame_pre_auth(Transport,
14581451
[],
14591452
C1,
14601453
State),
1461-
{C1#stream_connection{authentication_state =
1462-
done,
1463-
user = User,
1464-
connection_step =
1465-
authenticated},
1454+
{C1#stream_connection{user = User,
1455+
authentication_state = done,
1456+
connection_step = authenticated},
14661457
{sasl_authenticate, ?RESPONSE_CODE_OK,
14671458
<<>>}};
14681459
not_allowed ->

0 commit comments

Comments
 (0)