rabbitmq / rabbitmq-auth-backend-http

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

Pass tags to http backends #80

Closed romerod closed 5 years ago

romerod commented 5 years ago

The user_path returns tags for the user, this pull requests passes this tags to the other paths:

vhost_path resource_path topic_path

This makes it possible to do authorization with a tags(/roles) based approach.

See #79 for some history

pivotal-issuemaster commented 5 years ago

@romerod Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

pivotal-issuemaster commented 5 years ago

@romerod Thank you for signing the Contributor License Agreement!

romerod commented 5 years ago

As it's a list of atoms string.join didn't work without looping twice thru the list


From: Luke Bakken notifications@github.com Sent: Wednesday, February 27, 2019 5:53:06 PM To: rabbitmq/rabbitmq-auth-backend-http Cc: Daniel Romero; Author Subject: Re: [rabbitmq/rabbitmq-auth-backend-http] Pass tags to http backends (#80)

@lukebakken commented on this pull request.


In src/rabbit_auth_backend_http.erlhttps://github.com/rabbitmq/rabbitmq-auth-backend-http/pull/80#discussion_r260843721:

@@ -163,6 +166,9 @@ escape(K, V) ->

parse_resp(Resp) -> string:to_lower(string:strip(Resp)).

+join_tags([]) -> ""; +join_tags(Tags) -> string:substr(lists:foldr(fun(Elem, Acc) -> ", " ++ atom_to_list(Elem) ++ Acc end, "", Tags), 3).

I'd say give this a try - http://erlang.org/doc/man/string.html#join-2

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rabbitmq/rabbitmq-auth-backend-http/pull/80#pullrequestreview-208640933, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADEJ3gk7jRhXDetR8ZZGhUs2vyIxF2Hiks5vRrfygaJpZM4bUkxD.

michaelklishin commented 5 years ago

Merged manually, backported to v3.7.x.