Skip to content

Commit 0e02d37

Browse files
Improve format
1 parent 65a1ccd commit 0e02d37

File tree

1 file changed

+21
-12
lines changed
  • deps/rabbitmq_auth_backend_oauth2/src

1 file changed

+21
-12
lines changed

deps/rabbitmq_auth_backend_oauth2/src/rar.erl

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
-module(rar).
1010

1111
-include("oauth2.hrl").
12+
-import(uaa_jwt, [get_scope/1, set_scope/2]).
1213

1314
-export([extract_scopes_from_rich_auth_request/2, has_rich_auth_request_scopes/1]).
14-
-import(uaa_jwt, [get_scope/1, set_scope/2]).
1515

1616
-define(AUTHORIZATION_DETAILS_CLAIM, <<"authorization_details">>).
1717
-define(RAR_ACTIONS_FIELD, <<"actions">>).
@@ -23,13 +23,26 @@
2323
-define(RAR_QUEUE_LOCATION_ATTRIBUTE, <<"queue">>).
2424
-define(RAR_EXCHANGE_LOCATION_ATTRIBUTE, <<"exchange">>).
2525
-define(RAR_ROUTING_KEY_LOCATION_ATTRIBUTE, <<"routing-key">>).
26-
-define(RAR_LOCATION_ATTRIBUTES, [?RAR_CLUSTER_LOCATION_ATTRIBUTE, ?RAR_VHOST_LOCATION_ATTRIBUTE,
27-
?RAR_QUEUE_LOCATION_ATTRIBUTE, ?RAR_EXCHANGE_LOCATION_ATTRIBUTE, ?RAR_ROUTING_KEY_LOCATION_ATTRIBUTE]).
28-
29-
-define(RAR_ALLOWED_TAG_VALUES, [<<"monitoring">>, <<"administrator">>, <<"management">>, <<"policymaker">> ]).
30-
-define(RAR_ALLOWED_ACTION_VALUES, [<<"read">>, <<"write">>, <<"configure">>, <<"monitoring">>,
31-
<<"administrator">>, <<"management">>, <<"policymaker">> ]).
32-
26+
-define(RAR_LOCATION_ATTRIBUTES, [
27+
?RAR_CLUSTER_LOCATION_ATTRIBUTE,
28+
?RAR_VHOST_LOCATION_ATTRIBUTE,
29+
?RAR_QUEUE_LOCATION_ATTRIBUTE,
30+
?RAR_EXCHANGE_LOCATION_ATTRIBUTE,
31+
?RAR_ROUTING_KEY_LOCATION_ATTRIBUTE]).
32+
33+
-define(RAR_ALLOWED_TAG_VALUES, [
34+
<<"monitoring">>,
35+
<<"administrator">>,
36+
<<"management">>,
37+
<<"policymaker">> ]).
38+
-define(RAR_ALLOWED_ACTION_VALUES, [
39+
<<"read">>,
40+
<<"write">>,
41+
<<"configure">>,
42+
<<"monitoring">>,
43+
<<"administrator">>,
44+
<<"management">>,
45+
<<"policymaker">> ]).
3346

3447
-spec has_rich_auth_request_scopes(Payload::map()) -> boolean().
3548
has_rich_auth_request_scopes(Payload) ->
@@ -50,10 +63,6 @@ extract_scopes_from_rich_auth_request(ResourceServer,
5063
ExistingScopes = get_scope(Payload),
5164
set_scope(AdditionalScopes ++ ExistingScopes, Payload).
5265

53-
54-
55-
56-
5766
put_location_attribute(Attribute, Map) ->
5867
put_attribute(binary:split(Attribute, <<":">>, [global, trim_all]), Map).
5968

0 commit comments

Comments
 (0)