Merge pull request #5214 from tigercl/improve/authn
chore(auhtn): keep one ssl opts checking func
This commit is contained in:
commit
76f185538e
|
@ -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].
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
Loading…
Reference in New Issue