diff --git a/apps/emqx_auth_mnesia/src/emqx_auth_mnesia.app.src b/apps/emqx_auth_mnesia/src/emqx_auth_mnesia.app.src index a91849d24..9a3c51002 100644 --- a/apps/emqx_auth_mnesia/src/emqx_auth_mnesia.app.src +++ b/apps/emqx_auth_mnesia/src/emqx_auth_mnesia.app.src @@ -1,7 +1,7 @@ %% -*- mode: erlang -*- {application, emqx_auth_mnesia, [ {description, "EMQX Buitl-in Database Authentication and Authorization"}, - {vsn, "0.1.4"}, + {vsn, "0.1.5"}, {registered, []}, {mod, {emqx_auth_mnesia_app, []}}, {applications, [ diff --git a/apps/emqx_auth_mnesia/src/emqx_authn_mnesia.erl b/apps/emqx_auth_mnesia/src/emqx_authn_mnesia.erl index eec46d831..0c9631896 100644 --- a/apps/emqx_auth_mnesia/src/emqx_authn_mnesia.erl +++ b/apps/emqx_auth_mnesia/src/emqx_authn_mnesia.erl @@ -527,6 +527,10 @@ find_password_hash(hash, User = #{<<"password_hash">> := PasswordHash}, _) -> {PasswordHash, maps:get(<<"salt">>, User, <<>>)}; find_password_hash(plain, #{<<"password">> := Password}, Algorithm) -> emqx_authn_password_hashing:hash(Algorithm, Password); +find_password_hash(hash, _User, _) -> + error("hash_import_requires_password_hash_field"); +find_password_hash(plain, _User, _Algorithm) -> + error("plain_import_requires_password_field"); find_password_hash(_, _, _) -> error(bad_format). diff --git a/apps/emqx_auth_mnesia/test/emqx_authn_mnesia_SUITE.erl b/apps/emqx_auth_mnesia/test/emqx_authn_mnesia_SUITE.erl index c667901cb..54409a73f 100644 --- a/apps/emqx_auth_mnesia/test/emqx_authn_mnesia_SUITE.erl +++ b/apps/emqx_auth_mnesia/test/emqx_authn_mnesia_SUITE.erl @@ -228,6 +228,14 @@ t_import_users(_) -> State ) ), + %% import plain.json with hash method + ?assertEqual( + {error, "hash_import_requires_password_hash_field"}, + emqx_authn_mnesia:import_users( + sample_filename_and_data(hash, <<"user-credentials-plain.json">>), + State + ) + ), ?assertEqual( {error, bad_format}, @@ -289,6 +297,14 @@ t_import_users_plain(_) -> State ) ), + %% import hash.json with plain method + ?assertEqual( + {error, "plain_import_requires_password_field"}, + emqx_authn_mnesia:import_users( + sample_filename_and_data(plain, <<"user-credentials.json">>), + State + ) + ), ?assertEqual( ok, diff --git a/changes/ce/feat-12923.en.md b/changes/ce/feat-12923.en.md new file mode 100644 index 000000000..9721ea43a --- /dev/null +++ b/changes/ce/feat-12923.en.md @@ -0,0 +1 @@ +Provided more specific error when importing wrong format into builtin authenticate database. diff --git a/deploy/charts/emqx-enterprise/templates/StatefulSet.yaml b/deploy/charts/emqx-enterprise/templates/StatefulSet.yaml index 195bd698e..c3f82c647 100644 --- a/deploy/charts/emqx-enterprise/templates/StatefulSet.yaml +++ b/deploy/charts/emqx-enterprise/templates/StatefulSet.yaml @@ -184,5 +184,20 @@ spec: matchLabels: app.kubernetes.io/name: {{ include "emqx.name" $ }} app.kubernetes.io/instance: {{ $.Release.Name }} + {{- if .minDomains }} + minDomains: {{ .minDomains }} + {{- end }} + {{- if .matchLabelKeys }} + matchLabelKeys: + {{- range .matchLabelKeys }} + - {{ . }} + {{- end }} + {{- end }} + {{- if .nodeAffinityPolicy }} + nodeAffinityPolicy: {{ .nodeAffinityPolicy }} + {{- end }} + {{- if .nodeTaintsPolicy }} + nodeTaintsPolicy: {{ .nodeTaintsPolicy }} + {{- end }} {{- end }} {{- end }} diff --git a/deploy/charts/emqx/templates/StatefulSet.yaml b/deploy/charts/emqx/templates/StatefulSet.yaml index 85caa4297..ea7656a95 100644 --- a/deploy/charts/emqx/templates/StatefulSet.yaml +++ b/deploy/charts/emqx/templates/StatefulSet.yaml @@ -184,5 +184,20 @@ spec: matchLabels: app.kubernetes.io/name: {{ include "emqx.name" $ }} app.kubernetes.io/instance: {{ $.Release.Name }} + {{- if .minDomains }} + minDomains: {{ .minDomains }} + {{- end }} + {{- if .matchLabelKeys }} + matchLabelKeys: + {{- range .matchLabelKeys }} + - {{ . }} + {{- end }} + {{- end }} + {{- if .nodeAffinityPolicy }} + nodeAffinityPolicy: {{ .nodeAffinityPolicy }} + {{- end }} + {{- if .nodeTaintsPolicy }} + nodeTaintsPolicy: {{ .nodeTaintsPolicy }} + {{- end }} {{- end }} {{- end }}