Skip to content

Commit bac204d

Browse files
Fix test case
And remove log statements
1 parent fc7ef52 commit bac204d

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

deps/rabbitmq_auth_backend_oauth2/src/rabbit_auth_backend_oauth2.erl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@ check_topic_access(#auth_user{impl = DecodedTokenFun},
108108
with_decoded_token(DecodedTokenFun(),
109109
fun(Token) ->
110110
Scopes = get_expanded_scopes(Token, Resource),
111-
ct:log("check_topic_access Scoes: ~p ......", [Scopes]),
112-
ct:log("check_topic_access Resource: ~p Permisson: ~p Context:~p",
113-
[Resource,Permission, Context]),
114111
rabbit_oauth2_scope:topic_access(Resource, Permission, Context, Scopes)
115112
end).
116113

deps/rabbitmq_auth_backend_oauth2/src/rabbit_oauth2_scope.erl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ topic_access(#resource{virtual_host = VHost, name = ExchangeName},
4747
#{routing_key := RoutingKey},
4848
Scopes) ->
4949
lists:any(
50-
fun({VHostPattern, ExchangeNamePattern, RoutingKeyPattern, ScopeGrantedPermission}) ->
50+
fun({VHostPattern, ExchangeNamePattern, RoutingKeyPattern, ScopeGrantedPermission}) ->
5151
is_binary(RoutingKeyPattern) andalso
5252
wildcard:match(VHost, VHostPattern) andalso
5353
wildcard:match(ExchangeName, ExchangeNamePattern) andalso
@@ -62,10 +62,11 @@ topic_access(#resource{virtual_host = VHost, name = ExchangeName},
6262
get_scope_permissions(Scopes) when is_list(Scopes) ->
6363
lists:filtermap(
6464
fun(ScopeEl) ->
65-
case parse_permission_pattern(ScopeEl) of
65+
Ret = case parse_permission_pattern(ScopeEl) of
6666
ignore -> false;
6767
Perm -> {true, Perm}
68-
end
68+
end,
69+
Ret
6970
end,
7071
Scopes).
7172

@@ -88,7 +89,7 @@ parse_permission_pattern(_Other) ->
8889

8990
-spec parse_resource_pattern(binary(), permission()) ->
9091
{rabbit_types:vhost(), binary(), binary() | none, permission()} | 'ignore'.
91-
parse_resource_pattern(Pattern, Permission) ->
92+
parse_resource_pattern(Pattern, Permission) ->
9293
case binary:split(Pattern, <<"/">>, [global]) of
9394
[VhostPattern, NamePattern] ->
9495
{VhostPattern, NamePattern, none, Permission};

deps/rabbitmq_auth_backend_oauth2/test/unit_SUITE.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ test_successful_access_with_a_token_that_uses_single_scope_alias_with_var_expans
785785
Alias = <<"client-alias-1">>,
786786
set_env(scope_aliases, #{
787787
Alias => [
788-
<<"rabbitmq.configure:{vhost}/q-{sub}/{client_id}/*">>
788+
<<"rabbitmq.configure:{vhost}/q-{sub}/{client_id}**">>
789789
]
790790
}),
791791

0 commit comments

Comments
 (0)