Skip to content

Commit 3c7f84f

Browse files
authored
Merge pull request #8488 from rabbitmq/stream-fix-sasl-external
Fix SASL external authentication in stream plugin
2 parents 7f06a08 + 6c14d73 commit 3c7f84f

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 ::
@@ -1365,8 +1365,6 @@ handle_frame_pre_auth(Transport,
13651365
ServerProperties}}),
13661366
send(Transport, S, Frame),
13671367
{Connection#stream_connection{client_properties = ClientProperties,
1368-
authentication_state =
1369-
peer_properties_exchanged,
13701368
connection_step = peer_properties_exchanged},
13711369
State};
13721370
handle_frame_pre_auth(Transport,
@@ -1428,13 +1426,8 @@ handle_frame_pre_auth(Transport,
14281426
{C1#stream_connection{connection_step = failure},
14291427
{sasl_authenticate, ?RESPONSE_SASL_ERROR, <<>>}};
14301428
{challenge, Challenge, AuthState1} ->
1431-
rabbit_core_metrics:auth_attempt_succeeded(Host,
1432-
<<>>,
1433-
stream),
1434-
{C1#stream_connection{authentication_state =
1435-
AuthState1,
1436-
connection_step =
1437-
authenticating},
1429+
{C1#stream_connection{authentication_state = AuthState1,
1430+
connection_step = authenticating},
14381431
{sasl_authenticate, ?RESPONSE_SASL_CHALLENGE,
14391432
Challenge}};
14401433
{ok, User = #user{username = Username}} ->
@@ -1451,11 +1444,9 @@ handle_frame_pre_auth(Transport,
14511444
[],
14521445
C1,
14531446
State),
1454-
{C1#stream_connection{authentication_state =
1455-
done,
1456-
user = User,
1457-
connection_step =
1458-
authenticated},
1447+
{C1#stream_connection{user = User,
1448+
authentication_state = done,
1449+
connection_step = authenticated},
14591450
{sasl_authenticate, ?RESPONSE_CODE_OK,
14601451
<<>>}};
14611452
not_allowed ->

0 commit comments

Comments
 (0)