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