diff --git a/src/emqx_channel.erl b/src/emqx_channel.erl index ff964eff1..e96ffe2ed 100644 --- a/src/emqx_channel.erl +++ b/src/emqx_channel.erl @@ -1176,7 +1176,7 @@ enhanced_auth(?CONNECT_PACKET(#mqtt_packet_connect{ end; enhanced_auth(?AUTH_PACKET(_ReasonCode, Properties), Channel = #channel{conninfo = ConnInfo}) -> - AuthMethod = maps:get('Authentication-Method', maps:get(conn_props, ConnInfo), undefined), + AuthMethod = emqx_mqtt_props:get('Authentication-Method', emqx_mqtt_props:get(conn_props, ConnInfo, #{}), undefined), NAuthMethod = emqx_mqtt_props:get('Authentication-Method', Properties, undefined), AuthData = emqx_mqtt_props:get('Authentication-Data', Properties, undefined), case NAuthMethod =:= undefined orelse NAuthMethod =/= AuthMethod of diff --git a/test/emqx_channel_SUITE.erl b/test/emqx_channel_SUITE.erl index 086ff557e..2dba03dfb 100644 --- a/test/emqx_channel_SUITE.erl +++ b/test/emqx_channel_SUITE.erl @@ -152,6 +152,8 @@ t_handle_in_re_auth(_) -> }, {ok, [{outgoing, ?DISCONNECT_PACKET(?RC_BAD_AUTHENTICATION_METHOD)}, {close, bad_authentication_method}], _} = emqx_channel:handle_in(?AUTH_PACKET(?RC_RE_AUTHENTICATE,Properties), channel()), + {ok, [{outgoing, ?DISCONNECT_PACKET(?RC_BAD_AUTHENTICATION_METHOD)}, {close, bad_authentication_method}], _} = + emqx_channel:handle_in(?AUTH_PACKET(?RC_RE_AUTHENTICATE,Properties), channel(#{conninfo => #{proto_ver => ?MQTT_PROTO_V5, conn_props => undefined}})), {ok, [{outgoing, ?DISCONNECT_PACKET(?RC_NOT_AUTHORIZED)}, {close, not_authorized}], _} = emqx_channel:handle_in(?AUTH_PACKET(?RC_RE_AUTHENTICATE,Properties), channel(#{conninfo => #{proto_ver => ?MQTT_PROTO_V5, conn_props => Properties}})).