Rename result -> auth_result

This commit is contained in:
terry-xiaoyu 2019-03-21 22:49:02 +08:00 committed by turtleDeng
parent 998684fc4e
commit b79bf13ae7
2 changed files with 5 additions and 5 deletions

View File

@ -26,11 +26,11 @@
-spec(authenticate(emqx_types:credentials()) -spec(authenticate(emqx_types:credentials())
-> {ok, emqx_types:credentials()} | {error, term()}). -> {ok, emqx_types:credentials()} | {error, term()}).
authenticate(Credentials) -> authenticate(Credentials) ->
case emqx_hooks:run_fold('client.authenticate', [], Credentials#{result => init_result(Credentials)}) of case emqx_hooks:run_fold('client.authenticate', [], Credentials#{auth_result => init_auth_result(Credentials)}) of
#{result := success} = NewCredentials -> #{auth_result := success} = NewCredentials ->
{ok, NewCredentials}; {ok, NewCredentials};
NewCredentials -> NewCredentials ->
{error, maps:get(result, NewCredentials, unknown_error)} {error, maps:get(auth_result, NewCredentials, unknown_error)}
end. end.
%% @doc Check ACL %% @doc Check ACL
@ -61,7 +61,7 @@ do_check_acl(#{zone := Zone} = Credentials, PubSub, Topic) ->
reload_acl() -> reload_acl() ->
emqx_mod_acl_internal:reload_acl(). emqx_mod_acl_internal:reload_acl().
init_result(Credentials) -> init_auth_result(Credentials) ->
case emqx_zone:get_env(maps:get(zone, Credentials, undefined), allow_anonymous, false) of case emqx_zone:get_env(maps:get(zone, Credentials, undefined), allow_anonymous, false) of
true -> success; true -> success;
false -> not_authorized false -> not_authorized

View File

@ -153,4 +153,4 @@ connack_error(server_unavailable) -> ?RC_SERVER_UNAVAILABLE;
connack_error(server_busy) -> ?RC_SERVER_BUSY; connack_error(server_busy) -> ?RC_SERVER_BUSY;
connack_error(banned) -> ?RC_BANNED; connack_error(banned) -> ?RC_BANNED;
connack_error(bad_authentication_method) -> ?RC_BAD_AUTHENTICATION_METHOD; connack_error(bad_authentication_method) -> ?RC_BAD_AUTHENTICATION_METHOD;
connack_error(_) -> ?RC_NOT_AUTHORIZED. connack_error(_) -> ?RC_NOT_AUTHORIZED.