【发布时间】:2017-08-18 17:09:49
【问题描述】:
我已经配置了rabbitmq-auth-backend-http,我的rabbitmq.config 如下所示
[
{rabbit, [{auth_backends, [rabbit_auth_backend_http, rabbit_auth_backend_internal]}]},
{rabbitmq_auth_backend_http,
[{http_method, get},
{user_path, "http://localhost:8080/auth/user"},
{vhost_path, "http://localhost:8080/auth/vhost"},
{resource_path, "http://localhost:8080/auth/resource"},
{topic_path, "http://localhost:8080/auth/topic"}]}
].
授权端点http://localhost:8080/auth 已启动并正在运行。
但是当我尝试登录 http://localhost:15672/api/whoami 时,api 失败,状态码为 500。
使用 rabbitmq 内部数据库进行身份验证工作正常。唯一的问题是在auth_backends 中添加rabbit_auth_backend_http 不起作用。它甚至没有达到授权端点。我检查了var/rabbitmq/rabbit@localhost.log中的日志,
但没有帮助。我在这里发布日志
=错误报告==== 2017 年 8 月 18 日::21:55:46 === 牧场侦听器 rabbit_web_dispatch_sup_15672 在 退出时使用 cowboy_protocol:start_link/4 开始了连接过程,原因是:{[{reason,undef},{mfa,{rabbit_mgmt_wm_whoami,is_authorized,2}},{stacktrace,[{rabbit_auth_backend_http, user_login_authentication,[>,[{password,>}]],[]},{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,1263}]},{rabbit_mgmt_util,is_authorized,6,[{file,"src/rabbit_mgmt_util.erl"},{line,149}]}, {cowboy_rest,call,3,[{file,"src/cowboy_rest.erl"},{line,976}]},{cowboy_rest,is_authorized,2,[{file,"src/cowboy_rest.erl"},{line ,150}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,442}]}]},{req,[{socket,#Port}, {transport,ranch_tcp},{connection,keepalive},{pid,},{method,>},{version,'HTTP/1.1'},{peer,{{127 ,0,0,1 },51220}},{host,>},{host_info,undefined},{port,15672},{path,>},{path_info,undefined} ,{qs,>},{qs_vals,[]},{bindings,[]},{headers,[{>,>},{>,>},{>,>},{>,>},{>,>}, {>,/">>},{>,http://localhost:15672/">>},{>,>},{>,>},[{>,[>]}]},{cookies,undefined},{meta,[]},{body_state,waiting},{buffer,>}, {multipart,undefined},{resp_compress,true},{resp_state,waiting},{resp_headers,[{>,>}]},{resp_body,>} ,{onresponse,#Fun}]},{state,{context,undefined,none,undefined}}],[{cowboy_rest,error_terminate,5,[{file,"src/cowboy_rest.erl"},{line,1009 }]},{cowboy_rest,is_authorized,2,[{file,"src/cowboy_rest.erl"},{line,150}]},{cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl" },{line,442}]}]}
我做错了什么?
感谢您的帮助。
【问题讨论】:
标签: rabbitmq authorization messagebroker rabbitmqadmin