diff --git a/apps/emqx_authn/src/emqx_authn_api.erl b/apps/emqx_authn/src/emqx_authn_api.erl index 6627e935a..ee8757774 100644 --- a/apps/emqx_authn/src/emqx_authn_api.erl +++ b/apps/emqx_authn/src/emqx_authn_api.erl @@ -1006,10 +1006,11 @@ update_authenticator(ConfKeyPath, ChainName, AuthenticatorID, Config) -> ) of {ok, #{ - post_config_update := #{emqx_authentication := #{id := _ID}}, - raw_config := _AuthenticatorsConfig + post_config_update := #{emqx_authentication := #{id := ID}}, + raw_config := AuthenticatorsConfig }} -> - {204}; + {ok, AuthenticatorConfig} = find_config(ID, AuthenticatorsConfig), + {200, maps:put(id, ID, convert_certs(fill_defaults(AuthenticatorConfig)))}; {error, {_PrePostConfigUpdate, emqx_authentication, Reason}} -> serialize_error(Reason); {error, Reason} -> diff --git a/apps/emqx_authn/test/emqx_authn_api_SUITE.erl b/apps/emqx_authn/test/emqx_authn_api_SUITE.erl index 466aaddbe..a1047e25c 100644 --- a/apps/emqx_authn/test/emqx_authn_api_SUITE.erl +++ b/apps/emqx_authn/test/emqx_authn_api_SUITE.erl @@ -22,6 +22,7 @@ -include("emqx_authn.hrl"). -include_lib("eunit/include/eunit.hrl"). +-include_lib("common_test/include/ct.hrl"). -define(TCP_DEFAULT, 'tcp:default'). @@ -41,7 +42,7 @@ groups() -> init_per_testcase(t_authenticator_fail, Config) -> meck:expect(emqx_authn_proto_v1, lookup_from_all_nodes, 3, [{error, {exception, badarg}}]), init_per_testcase(default, Config); -init_per_testcase(_Case, Config) -> +init_per_testcase(_, Config) -> {ok, _} = emqx_cluster_rpc:start_link(node(), emqx_cluster_rpc, 1000), emqx_authn_test_lib:delete_authenticators( [?CONF_NS_ATOM], @@ -212,7 +213,7 @@ test_authenticators(PathPrefix) -> method => <<"get">>, headers => #{<<"content-type">> => <<"application/json">>} }, - {ok, 204, _} = request( + {ok, 200, _} = request( put, uri(PathPrefix ++ [?CONF_NS, "password_based:http"]), ValidConfig1 @@ -301,14 +302,14 @@ test_authenticator(PathPrefix) -> method => <<"get">>, headers => #{<<"content-type">> => <<"application/json">>} }, - {ok, 204, _} = request( + {ok, 200, _} = request( put, uri(PathPrefix ++ [?CONF_NS, "password_based:http"]), ValidConfig1 ), ValidConfig2 = ValidConfig0#{pool_size => 9}, - {ok, 204, _} = request( + {ok, 200, _} = request( put, uri(PathPrefix ++ [?CONF_NS, "password_based:http"]), ValidConfig2 diff --git a/apps/emqx_authn/test/emqx_authn_jwt_SUITE.erl b/apps/emqx_authn/test/emqx_authn_jwt_SUITE.erl index 547f173d5..e84f87f0b 100644 --- a/apps/emqx_authn/test/emqx_authn_jwt_SUITE.erl +++ b/apps/emqx_authn/test/emqx_authn_jwt_SUITE.erl @@ -448,7 +448,7 @@ t_jwt_not_allow_empty_claim_name(_) -> ), ?assertMatch( - {204}, + {200, _}, emqx_authn_api:authenticator( put, #{ bindings => #{id => <<"jwt">>}, diff --git a/changes/v5.0.12-en.md b/changes/v5.0.12-en.md index 0b6a6feed..9baaa9d75 100644 --- a/changes/v5.0.12-en.md +++ b/changes/v5.0.12-en.md @@ -14,8 +14,6 @@ - Refactor authn API by replacing `POST /authentication/{id}/move` with `PUT /authentication/{id}/position/{position}`. [#9419](https://github.com/emqx/emqx/pull/9419). Same is done for `/listeners/{listener_id}/authentication/id/...`. -- Return `204` instead of `200` for `PUT /authenticator/:id` [#9434](https://github.com/emqx/emqx/pull/9434/). - ## Bug fixes - Fix that the obsolete SSL files aren't deleted after the ExHook config update [#9432](https://github.com/emqx/emqx/pull/9432). diff --git a/changes/v5.0.12-zh.md b/changes/v5.0.12-zh.md index cde03f3d8..82c2796c4 100644 --- a/changes/v5.0.12-zh.md +++ b/changes/v5.0.12-zh.md @@ -4,8 +4,6 @@ - 通过 `node.global_gc_interval = disabled` 来禁用全局垃圾回收 [#9418](https://github.com/emqx/emqx/pull/9418)。 -- 现在,`PUT /authenticator/:id` 将会返回 204 而不再是 200 [#9434](https://github.com/emqx/emqx/pull/9434/)。 - - 优化命令行实现, 避免输入错误指令时, 产生不必要的原子表消耗 [#9416](https://github.com/emqx/emqx/pull/9416)。 - 支持在 Apple Silicon 架构下编译苹果系统的发行版本 [#9423](https://github.com/emqx/emqx/pull/9423)。