diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_direct.erl | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/rabbit_direct.erl b/src/rabbit_direct.erl index 0dac18d1fe..7ad63e815e 100644 --- a/src/rabbit_direct.erl +++ b/src/rabbit_direct.erl @@ -16,7 +16,7 @@ -module(rabbit_direct). --export([boot/0, connect/5, start_channel/8, disconnect/1]). +-export([boot/0, connect/4, start_channel/8, disconnect/1]). -include("rabbit.hrl"). @@ -25,7 +25,7 @@ -ifdef(use_specs). -spec(boot/0 :: () -> 'ok'). --spec(connect/5 :: (binary(), binary(), binary(), rabbit_types:protocol(), +-spec(connect/4 :: (binary(), binary(), rabbit_types:protocol(), rabbit_event:event_props()) -> {'ok', {rabbit_types:user(), rabbit_framing:amqp_table()}}). @@ -53,11 +53,11 @@ boot() -> %%---------------------------------------------------------------------------- -connect(Username, Password, VHost, Protocol, Infos) -> +connect(Username, VHost, Protocol, Infos) -> case lists:keymember(rabbit, 1, application:which_applications()) of true -> - try rabbit_access_control:user_pass_login(Username, Password) of - #user{} = User -> + case rabbit_access_control:check_user_login(Username, []) of + {ok, User} -> try rabbit_access_control:check_vhost_access(User, VHost) of ok -> rabbit_event:notify(connection_created, Infos), {ok, {User, @@ -65,9 +65,9 @@ connect(Username, Password, VHost, Protocol, Infos) -> catch exit:#amqp_error{name = access_refused} -> {error, access_refused} - end - catch - exit:#amqp_error{name = access_refused} -> {error, auth_failure} + end; + {refused, _Msg, _Args} -> + {error, auth_failure} end; false -> {error, broker_not_found_on_node} |
