Skip to content

Commit 540c761

Browse files
acogoluegnesmergify[bot]
authored andcommitted
Fix SASL external authentication in stream plugin
(cherry picked from commit 2134749)
1 parent ef64f51 commit 540c761

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

deps/rabbitmq_stream/src/rabbit_stream_reader.erl

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
stream_leaders :: #{stream() => pid()},
7676
stream_subscriptions :: #{stream() => [subscription_id()]},
7777
credits :: atomics:atomics_ref(),
78-
authentication_state :: atom(),
78+
authentication_state :: any(),
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,
@@ -1431,10 +1429,8 @@ handle_frame_pre_auth(Transport,
14311429
rabbit_core_metrics:auth_attempt_succeeded(Host,
14321430
<<>>,
14331431
stream),
1434-
{C1#stream_connection{authentication_state =
1435-
AuthState1,
1436-
connection_step =
1437-
authenticating},
1432+
{C1#stream_connection{authentication_state = AuthState1,
1433+
connection_step = authenticating},
14381434
{sasl_authenticate, ?RESPONSE_SASL_CHALLENGE,
14391435
Challenge}};
14401436
{ok, User = #user{username = Username}} ->
@@ -1451,11 +1447,9 @@ handle_frame_pre_auth(Transport,
14511447
[],
14521448
C1,
14531449
State),
1454-
{C1#stream_connection{authentication_state =
1455-
done,
1456-
user = User,
1457-
connection_step =
1458-
authenticated},
1450+
{C1#stream_connection{user = User,
1451+
authentication_state = done,
1452+
connection_step = authenticated},
14591453
{sasl_authenticate, ?RESPONSE_CODE_OK,
14601454
<<>>}};
14611455
not_allowed ->

0 commit comments

Comments
 (0)