diff options
author | Magnus Feuer <mfeuer@jaguarlandrover.com> | 2015-08-18 16:28:17 -0700 |
---|---|---|
committer | Magnus Feuer <mfeuer@jaguarlandrover.com> | 2015-08-18 16:28:17 -0700 |
commit | c3cd101edffa0f589b2ad1c9e480312b55c97e64 (patch) | |
tree | bc3ea05f3faa739194a1bc8e53331756f80e2d55 /components | |
parent | 9cf37356f2800ecd7fd87e267550f471b458e270 (diff) | |
download | rvi_core-c3cd101edffa0f589b2ad1c9e480312b55c97e64.tar.gz |
Remote messages now authorized.
Diffstat (limited to 'components')
-rw-r--r-- | components/authorize/src/authorize_rpc.erl | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/components/authorize/src/authorize_rpc.erl b/components/authorize/src/authorize_rpc.erl index 155bd4f..2df4298 100644 --- a/components/authorize/src/authorize_rpc.erl +++ b/components/authorize/src/authorize_rpc.erl @@ -305,15 +305,20 @@ handle_call({rvi, authorize_local_message, [Service, Params] } = R, _From, {reply, [ not_found ], State} end; -handle_call({rvi, authorize_remote_message, [_Service, Params]}=R, +handle_call({rvi, authorize_remote_message, [_Service, Params]}, _From, State) -> - ?debug("authorize_rpc:handle_call(~p)~n", [R]), IP = proplists:get_value(remote_ip, Params), Port = proplists:get_value(remote_port, Params), Timeout = proplists:get_value(timeout, Params), - SvcName = proplists:get_value(service, Params), + SvcName = proplists:get_value(service_name, Params), Parameters = proplists:get_value(parameters, Params), Signature = proplists:get_value(signature, Params), + ?debug("authorize_rpc:authorize_remote_message(): remote_ip: ~p~n", [IP]), + ?debug("authorize_rpc:authorize_remote_message(): remote_port: ~p~n", [Port]), + ?debug("authorize_rpc:authorize_remote_message(): timeout: ~p~n", [Timeout]), + ?debug("authorize_rpc:authorize_remote_message(): service_name: ~p~n", [SvcName]), + ?debug("authorize_rpc:authorize_remote_message(): parameters: ~p~n", [Parameters]), + ?debug("authorize_rpc:authorize_remote_message(): signature: ~40s~n", [Signature]), case authorize_keys:validate_message( iolist_to_binary(Signature), {IP, Port}) of invalid -> @@ -322,7 +327,11 @@ handle_call({rvi, authorize_remote_message, [_Service, Params]}=R, {ok, Timeout1} = rvi_common:get_json_element(["timeout"], Msg), {ok, SvcName1} = rvi_common:get_json_element(["service_name"], Msg), {ok, Params1} = rvi_common:get_json_element(["parameters"], Msg), - if Timeout =:= Timeout1, + ?debug("authorize_rpc:authorize_remote_message(): timeout1: ~p~n", [Timeout1]), + ?debug("authorize_rpc:authorize_remote_message(): service_name1: ~p~n", [SvcName1]), + ?debug("authorize_rpc:authorize_remote_message(): parameters1: ~p~n", [Params1]), + + if Timeout =:= Timeout1 * 1000, SvcName =:= SvcName1, Parameters =:= Params1 -> ?debug("Remote message authorized.~n", []), |