fix(ssl): fix the issue that the content of TLS certificate is not converted to path
This commit is contained in:
parent
c202688abf
commit
81d425cb27
|
@ -107,29 +107,25 @@ do_pre_config_update({move_authenticator, _ChainName, AuthenticatorID, Position}
|
|||
post_config_update(_, UpdateReq, NewConfig, OldConfig, AppEnvs) ->
|
||||
do_post_config_update(UpdateReq, check_configs(to_list(NewConfig)), OldConfig, AppEnvs).
|
||||
|
||||
do_post_config_update({create_authenticator, ChainName, Config}, _NewConfig, _OldConfig, _AppEnvs) ->
|
||||
NConfig = check_config(Config),
|
||||
do_post_config_update({create_authenticator, ChainName, Config}, NewConfig, _OldConfig, _AppEnvs) ->
|
||||
NConfig = get_authenticator_config(authenticator_id(Config), NewConfig),
|
||||
_ = emqx_authentication:create_chain(ChainName),
|
||||
emqx_authentication:create_authenticator(ChainName, NConfig);
|
||||
do_post_config_update({delete_authenticator, ChainName, AuthenticatorID}, _NewConfig, OldConfig, _AppEnvs) ->
|
||||
case emqx_authentication:delete_authenticator(ChainName, AuthenticatorID) of
|
||||
ok ->
|
||||
[Config] = [Config0 || Config0 <- to_list(OldConfig), AuthenticatorID == authenticator_id(Config0)],
|
||||
Config = get_authenticator_config(AuthenticatorID, to_list(OldConfig)),
|
||||
CertsDir = certs_dir(ChainName, AuthenticatorID),
|
||||
ok = clear_certs(CertsDir, Config);
|
||||
{error, Reason} ->
|
||||
{error, Reason}
|
||||
end;
|
||||
do_post_config_update({update_authenticator, ChainName, AuthenticatorID, Config}, _NewConfig, _OldConfig, _AppEnvs) ->
|
||||
NConfig = check_config(Config),
|
||||
do_post_config_update({update_authenticator, ChainName, AuthenticatorID, Config}, NewConfig, _OldConfig, _AppEnvs) ->
|
||||
NConfig = get_authenticator_config(authenticator_id(Config), NewConfig),
|
||||
emqx_authentication:update_authenticator(ChainName, AuthenticatorID, NConfig);
|
||||
do_post_config_update({move_authenticator, ChainName, AuthenticatorID, Position}, _NewConfig, _OldConfig, _AppEnvs) ->
|
||||
emqx_authentication:move_authenticator(ChainName, AuthenticatorID, Position).
|
||||
|
||||
check_config(Config) ->
|
||||
[Checked] = check_configs([Config]),
|
||||
Checked.
|
||||
|
||||
check_configs(Configs) ->
|
||||
Providers = emqx_authentication:get_providers(),
|
||||
lists:map(fun(C) -> do_check_conifg(C, Providers) end, Configs).
|
||||
|
@ -208,6 +204,10 @@ clear_certs(CertsDir, Config) ->
|
|||
OldSSL = maps:get(<<"ssl">>, Config, undefined),
|
||||
ok = emqx_tls_lib:delete_ssl_files(CertsDir, undefined, OldSSL).
|
||||
|
||||
get_authenticator_config(AuthenticatorID, AuthenticatorsConfig) ->
|
||||
[C] = [C0 || C0 <- AuthenticatorsConfig, AuthenticatorID == authenticator_id(C0)],
|
||||
C.
|
||||
|
||||
split_by_id(ID, AuthenticatorsConfig) ->
|
||||
case lists:foldl(
|
||||
fun(C, {P1, P2, F0}) ->
|
||||
|
|
Loading…
Reference in New Issue