|
@@ -1158,12 +1158,12 @@ authentication(post, Request) ->
|
|
|
authenticators(post, Request) ->
|
|
authenticators(post, Request) ->
|
|
|
{ok, Body, _} = cowboy_req:read_body(Request),
|
|
{ok, Body, _} = cowboy_req:read_body(Request),
|
|
|
AuthenticatorConfig = emqx_json:decode(Body, [return_maps]),
|
|
AuthenticatorConfig = emqx_json:decode(Body, [return_maps]),
|
|
|
- Config = #{<<"emqx_authn">> => #{
|
|
|
|
|
|
|
+ Config = #{<<"authentication">> => #{
|
|
|
<<"authenticators">> => [AuthenticatorConfig]
|
|
<<"authenticators">> => [AuthenticatorConfig]
|
|
|
}},
|
|
}},
|
|
|
NConfig = hocon_schema:check_plain(emqx_authn_schema, Config,
|
|
NConfig = hocon_schema:check_plain(emqx_authn_schema, Config,
|
|
|
#{nullable => true}),
|
|
#{nullable => true}),
|
|
|
- #{emqx_authn := #{authenticators := [NAuthenticatorConfig]}} = emqx_map_lib:unsafe_atom_key_map(NConfig),
|
|
|
|
|
|
|
+ #{authentication := #{authenticators := [NAuthenticatorConfig]}} = emqx_map_lib:unsafe_atom_key_map(NConfig),
|
|
|
case emqx_authn:create_authenticator(?CHAIN, NAuthenticatorConfig) of
|
|
case emqx_authn:create_authenticator(?CHAIN, NAuthenticatorConfig) of
|
|
|
{ok, Authenticator2} ->
|
|
{ok, Authenticator2} ->
|
|
|
{201, Authenticator2};
|
|
{201, Authenticator2};
|