From 5bb55332a52f88df1adf9da474e8aab2092cd5cb Mon Sep 17 00:00:00 2001 From: zhouzb Date: Mon, 12 Jul 2021 16:29:44 +0800 Subject: [PATCH] chore(auhtn): keep one ssl opts checking func --- .../emqx_authn/src/simple_authn/emqx_authn_http.erl | 13 +------------ apps/emqx_connector/src/emqx_connector_http.erl | 2 ++ 2 files changed, 3 insertions(+), 12 deletions(-) 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 71929b944..692ff924e 100644 --- a/apps/emqx_authn/src/simple_authn/emqx_authn_http.erl +++ b/apps/emqx_authn/src/simple_authn/emqx_authn_http.erl @@ -72,7 +72,7 @@ common_fields() -> ] ++ proplists:delete(base_url, emqx_connector_http:fields(config)). validations() -> - [ {check_ssl_opts, fun check_ssl_opts/1} ]. + [ {check_ssl_opts, fun emqx_connector_http:check_ssl_opts/1} ]. url(type) -> binary(); url(nullable) -> false; @@ -190,17 +190,6 @@ check_form_data(FormData) -> false end. -check_ssl_opts(Conf) -> - URL = hocon_schema:get_value("url", Conf), - {ok, #{scheme := Scheme}} = emqx_http_lib:uri_parse(URL), - SSLOpts = hocon_schema:get_value("ssl_opts", Conf), - case {Scheme, SSLOpts} of - {http, undefined} -> true; - {http, _} -> false; - {https, undefined} -> false; - {https, _} -> true - end. - preprocess_form_data(FormData) -> KVs = binary:split(FormData, [<<"&">>], [global]), [list_to_tuple(binary:split(KV, [<<"=">>], [global])) || KV <- KVs]. diff --git a/apps/emqx_connector/src/emqx_connector_http.erl b/apps/emqx_connector/src/emqx_connector_http.erl index 807243038..bef5c26f3 100644 --- a/apps/emqx_connector/src/emqx_connector_http.erl +++ b/apps/emqx_connector/src/emqx_connector_http.erl @@ -32,6 +32,8 @@ , fields/1 , validations/0]). +-export([ check_ssl_opts/1 ]). + -type connect_timeout() :: non_neg_integer() | infinity. -type pool_type() :: random | hash.