From 1c22c0d596f3163d0a2355ca20231f4fda893559 Mon Sep 17 00:00:00 2001 From: Zaiming Shi Date: Wed, 20 Oct 2021 14:36:37 +0200 Subject: [PATCH] fix(authn): rename config key http-server to http --- apps/emqx_authn/src/emqx_authn.erl | 3 +-- apps/emqx_authn/src/emqx_authn_api.erl | 8 ++++---- apps/emqx_authn/src/simple_authn/emqx_authn_http.erl | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/apps/emqx_authn/src/emqx_authn.erl b/apps/emqx_authn/src/emqx_authn.erl index 1b0d12fd2..a49aacff4 100644 --- a/apps/emqx_authn/src/emqx_authn.erl +++ b/apps/emqx_authn/src/emqx_authn.erl @@ -28,8 +28,7 @@ providers() -> , {{'password-based', postgresql}, emqx_authn_pgsql} , {{'password-based', mongodb}, emqx_authn_mongodb} , {{'password-based', redis}, emqx_authn_redis} - , {{'password-based', 'http-server'}, emqx_authn_http} - , {{'password-based', 'http'}, emqx_authn_http} %% TODO: resolve one + , {{'password-based', 'http'}, emqx_authn_http} , {jwt, emqx_authn_jwt} , {{scram, 'built-in-database'}, emqx_enhanced_authn_scram_mnesia} ]. diff --git a/apps/emqx_authn/src/emqx_authn_api.erl b/apps/emqx_authn/src/emqx_authn_api.erl index 93df83829..f8e8bf5de 100644 --- a/apps/emqx_authn/src/emqx_authn_api.erl +++ b/apps/emqx_authn/src/emqx_authn_api.erl @@ -43,7 +43,7 @@ }}). -define(EXAMPLE_2, #{mechanism => <<"password-based">>, - backend => <<"http-server">>, + backend => <<"http">>, method => <<"post">>, url => <<"http://localhost:80/login">>, headers => #{ @@ -90,7 +90,7 @@ -define(INSTANCE_EXAMPLE_1, maps:merge(?EXAMPLE_1, #{id => <<"password-based:built-in-database">>, enable => true})). --define(INSTANCE_EXAMPLE_2, maps:merge(?EXAMPLE_2, #{id => <<"password-based:http-server">>, +-define(INSTANCE_EXAMPLE_2, maps:merge(?EXAMPLE_2, #{id => <<"password-based:http">>, connect_timeout => "5s", enable_pipelining => true, headers => #{ @@ -1506,8 +1506,8 @@ definitions() -> }, backend => #{ type => string, - enum => [<<"http-server">>], - example => <<"http-server">> + enum => [<<"http">>], + example => <<"http">> }, method => #{ type => string, diff --git a/apps/emqx_authn/src/simple_authn/emqx_authn_http.erl b/apps/emqx_authn/src/simple_authn/emqx_authn_http.erl index bbfdaf319..c99806341 100644 --- a/apps/emqx_authn/src/simple_authn/emqx_authn_http.erl +++ b/apps/emqx_authn/src/simple_authn/emqx_authn_http.erl @@ -61,8 +61,8 @@ fields(post) -> ] ++ common_fields(). common_fields() -> - [ {mechanism, {enum, ['password-based']}} - , {backend, {enum, ['http-server', 'http']}} %% TODO: delete http + [ {mechanism, 'password-based'} + , {backend, 'http'} , {url, fun url/1} , {body, fun body/1} , {request_timeout, fun request_timeout/1}