fix(authn): fix bug in authn
This commit is contained in:
parent
b89973ce7c
commit
69755ad3fb
|
@ -272,10 +272,7 @@ do_post_config_update({delete_authenticator, ChainName, AuthenticatorID}, _NewCo
|
|||
{error, Reason}
|
||||
end;
|
||||
|
||||
do_post_config_update({update_authenticator, ChainName, AuthenticatorID, _Config}, NewConfig, _OldConfig, _AppEnvs) ->
|
||||
[Config] = lists:filter(fun(NewConfig0) ->
|
||||
AuthenticatorID =:= generate_id(NewConfig0)
|
||||
end, NewConfig),
|
||||
do_post_config_update({update_authenticator, ChainName, AuthenticatorID, Config}, _NewConfig, _OldConfig, _AppEnvs) ->
|
||||
NConfig = check_config(Config),
|
||||
update_authenticator(ChainName, AuthenticatorID, NConfig);
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ validations() ->
|
|||
|
||||
url(type) -> binary();
|
||||
url(nullable) -> false;
|
||||
url(validate) -> [fun check_url/1];
|
||||
url(validator) -> [fun check_url/1];
|
||||
url(_) -> undefined.
|
||||
|
||||
headers(type) -> map();
|
||||
|
@ -99,7 +99,7 @@ headers_no_content_type(_) -> undefined.
|
|||
|
||||
body(type) -> map();
|
||||
body(nullable) -> false;
|
||||
body(validate) -> [fun check_body/1];
|
||||
body(validator) -> [fun check_body/1];
|
||||
body(_) -> undefined.
|
||||
|
||||
request_timeout(type) -> non_neg_integer();
|
||||
|
|
|
@ -123,7 +123,7 @@ server_name_indication(_) -> undefined.
|
|||
|
||||
verify_claims(type) -> list();
|
||||
verify_claims(default) -> #{};
|
||||
verify_claims(validate) -> [fun check_verify_claims/1];
|
||||
verify_claims(validator) -> [fun do_check_verify_claims/1];
|
||||
verify_claims(converter) ->
|
||||
fun(VerifyClaims) ->
|
||||
maps:to_list(VerifyClaims)
|
||||
|
@ -298,12 +298,8 @@ do_verify_claims(Claims, [{Name, Value} | More]) ->
|
|||
{error, {claims, {Name, Value0}}}
|
||||
end.
|
||||
|
||||
check_verify_claims(Conf) ->
|
||||
Claims = hocon_schema:get_value("verify_claims", Conf),
|
||||
do_check_verify_claims(Claims).
|
||||
|
||||
do_check_verify_claims([]) ->
|
||||
false;
|
||||
true;
|
||||
do_check_verify_claims([{Name, Expected} | More]) ->
|
||||
check_claim_name(Name) andalso
|
||||
check_claim_expected(Expected) andalso
|
||||
|
|
|
@ -65,10 +65,10 @@ validations() ->
|
|||
|
||||
base_url(type) -> url();
|
||||
base_url(nullable) -> false;
|
||||
base_url(validate) -> fun (#{query := _Query}) ->
|
||||
{error, "There must be no query in the base_url"};
|
||||
base_url(validator) -> fun(#{query := _Query}) ->
|
||||
{error, "There must be no query in the base_url"};
|
||||
(_) -> ok
|
||||
end;
|
||||
end;
|
||||
base_url(_) -> undefined.
|
||||
|
||||
connect_timeout(type) -> connect_timeout();
|
||||
|
|
Loading…
Reference in New Issue