rabbitmq / rabbitmq-auth-backend-http

HTTP-based authorisation and authentication for RabbitMQ
Other
199 stars 72 forks source link

Plugin fails with error undefined #43

Closed rayalex closed 7 years ago

rayalex commented 7 years ago

I've tried setting up this plugin on RabbitMQ 3.6.6, however it seems to be failing with unknown error. HTTP Server logs indicate that request was never received, so it's probably failing before that.

Setup:

Configuration:

[
 {rabbit, [{auth_backends, [rabbitmq_auth_backend_http]}]},
 {rabbitmq_auth_backend_http,
  [{http_method,   post},
   {user_path,     "http://192.168.1.101/auth/user"},
   {vhost_path,    "http://192.168.1.101/auth/vhost"},
   {resource_path, "http://192.168.1.101/auth/resource"}]}
].

Server is configured to always return allow and allow administrator for user path.

Logs:

Starting RabbitMQ 3.6.6 on Erlang 18.3
Copyright (C) 2007-2016 Pivotal Software, Inc.
Licensed under the MPL.  See http://www.rabbitmq.com/

*** snip

=INFO REPORT==== 11-Dec-2016::11:58:28 ===
Server startup complete; 8 plugins started.
 * rabbitmq_management
 * rabbitmq_management_agent
 * rabbitmq_web_dispatch
 * rabbitmq_mqtt
 * rabbitmq_auth_backend_http
 * webmachine
 * mochiweb
 * amqp_client

*** snip

=ERROR REPORT==== 11-Dec-2016::11:58:29 ===
webmachine error: path="/api/whoami"
{error,undef,
       [{rabbitmq_auth_backend_http,user_login_authentication,
                                    [<<"123">>,[{password,<<"123">>}]],
                                    []},
        {rabbit_access_control,try_authenticate,3,
                               [{file,"src/rabbit_access_control.erl"},
                                {line,88}]},
        {rabbit_access_control,'-check_user_login/2-fun-0-',4,
                               [{file,"src/rabbit_access_control.erl"},
                                {line,74}]},
        {lists,foldl,3,[{file,"lists.erl"},{line,1262}]},
        {rabbit_mgmt_util,is_authorized,6,
                          [{file,"src/rabbit_mgmt_util.erl"},{line,134}]},
        {webmachine_resource,resource_call,3,
                             [{file,"src/webmachine_resource.erl"},
                              {line,186}]},
        {webmachine_resource,do,3,
                             [{file,"src/webmachine_resource.erl"},
                              {line,142}]},
        {webmachine_decision_core,resource_call,1,
                                  [{file,"src/webmachine_decision_core.erl"},
                                   {line,48}]}]}

Any ideas what might be an issue here?

Thanks.

EDIT:

Resolution: First line of configuration should say {rabbit, [{auth_backends, [rabbit_auth_backend_http]}]}, instead of {rabbit, [{auth_backends, [rabbitmq_auth_backend_http]}]},

michaelklishin commented 7 years ago

Please post questions to rabbitmq-users or Stack Overflow. RabbitMQ uses GitHub issues for specific actionable items engineers can work on, not questions. Thank you.

michaelklishin commented 7 years ago

The error says thatrabbitmq_auth_backend_http:user_login_authentication/3 is undefined. Your config is incomplete and I suspect it may be incorrectly nested. Please take this to the mailing list.

michaelklishin commented 7 years ago

There's plenty of examples of authn/authz backend configurations, including this very plugin, in the docs.

rayalex commented 7 years ago

@michaelklishin The issue indeed was in my configuration, thanks.