Skip to content

Commit

Permalink
Merge pull request #8490 from rabbitmq/mergify/bp/v3.11.x/pr-8489
Browse files Browse the repository at this point in the history
Fix SASL external authentication in stream plugin (backport #8488) (backport #8489)
  • Loading branch information
acogoluegnes committed Jun 6, 2023
2 parents 2023a3c + 7ab9cb0 commit a9a32e9
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions deps/rabbitmq_stream/src/rabbit_stream_reader.erl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
%% client port
peer_port,
auth_mechanism,
authentication_state :: any(),
connected_at :: integer(),
helper_sup :: pid(),
socket :: rabbit_net:socket(),
Expand All @@ -75,7 +76,6 @@
stream_leaders :: #{stream() => pid()},
stream_subscriptions :: #{stream() => [subscription_id()]},
credits :: atomics:atomics_ref(),
authentication_state :: atom(),
user :: undefined | #user{},
virtual_host :: undefined | binary(),
connection_step ::
Expand Down Expand Up @@ -1371,8 +1371,6 @@ handle_frame_pre_auth(Transport,
ServerProperties}}),
send(Transport, S, Frame),
{Connection#stream_connection{client_properties = ClientProperties,
authentication_state =
peer_properties_exchanged,
connection_step = peer_properties_exchanged},
State};
handle_frame_pre_auth(Transport,
Expand Down Expand Up @@ -1435,13 +1433,8 @@ handle_frame_pre_auth(Transport,
{C1#stream_connection{connection_step = failure},
{sasl_authenticate, ?RESPONSE_SASL_ERROR, <<>>}};
{challenge, Challenge, AuthState1} ->
rabbit_core_metrics:auth_attempt_succeeded(RemoteAddress,
<<>>,
stream),
{C1#stream_connection{authentication_state =
AuthState1,
connection_step =
authenticating},
{C1#stream_connection{authentication_state = AuthState1,
connection_step = authenticating},
{sasl_authenticate, ?RESPONSE_SASL_CHALLENGE,
Challenge}};
{ok, User = #user{username = Username}} ->
Expand All @@ -1458,11 +1451,9 @@ handle_frame_pre_auth(Transport,
[],
C1,
State),
{C1#stream_connection{authentication_state =
done,
user = User,
connection_step =
authenticated},
{C1#stream_connection{user = User,
authentication_state = done,
connection_step = authenticated},
{sasl_authenticate, ?RESPONSE_CODE_OK,
<<>>}};
not_allowed ->
Expand Down

0 comments on commit a9a32e9

Please sign in to comment.