2525-define (BOB_NAME , " Bob" ).
2626-define (CAROL_NAME , " Carol" ).
2727-define (PETER_NAME , " Peter" ).
28+ -define (JIMMY_NAME , " Jimmy" ).
2829
2930-define (VHOST , " test" ).
3031-define (DEFAULT_LDAP_PORT , " 3890" ).
4546 password = <<" password" >>,
4647 virtual_host = <<? VHOST >>}).
4748
49+ -define (JIMMY , # amqp_params_network {username = <<? JIMMY_NAME >>,
50+ password = <<" password" >>,
51+ virtual_host = <<? VHOST >>}).
52+
4853-define (BASE_CONF_RABBIT , {rabbit , [{default_vhost , <<" test" >>}]}).
4954
5055base_conf_ldap (LdapPort , IdleTimeout , PoolSize ) ->
@@ -113,7 +118,8 @@ groups() ->
113118 invalid_and_clause_ldap_only ,
114119 topic_authorisation_publishing_ldap_only ,
115120 topic_authorisation_consumption ,
116- match_bidirectional
121+ match_bidirectional ,
122+ match_bidirectional_gh_100
117123 ],
118124 [
119125 {non_parallel_tests , [], Tests
@@ -475,10 +481,8 @@ topic_authorisation_consumption1(Config) ->
475481 false = rabbit_auth_backend_ldap :check_topic_access (Alice , Resource , read , #{routing_key => <<" b.c" >>}),
476482 % % user KO, routing key OK, should fail
477483 false = rabbit_auth_backend_ldap :check_topic_access (Bob , Resource , read , #{routing_key => <<" a.b.c" >>}),
478-
479484 ok .
480485
481-
482486match_bidirectional (Config ) ->
483487 ok = rabbit_ct_broker_helpers :rpc (Config , 0 ,
484488 application , set_env , [rabbit , auth_backends , [rabbit_auth_backend_ldap ]]),
@@ -500,6 +504,25 @@ match_bidirectional(Config) ->
500504 end || ConfigurationFunction <- Configurations ],
501505 ok .
502506
507+ match_bidirectional_gh_100 (Config ) ->
508+ ok = rabbit_ct_broker_helpers :rpc (Config , 0 ,
509+ application , set_env , [rabbit , auth_backends , [rabbit_auth_backend_ldap ]]),
510+
511+ Configurations = [
512+ fun resource_access_query_match_gh_100 /0 ,
513+ fun resource_access_query_match_query_is_string_gh_100 /0
514+ ],
515+
516+ [begin
517+ set_env (Config , ConfigurationFunction ()),
518+ Q1 = [# 'queue.declare' {queue = <<" Jimmy-queue" >>}],
519+ Q2 = [# 'queue.declare' {queue = <<" Jimmy" >>}],
520+ P = # amqp_params_network {port = rabbit_ct_broker_helpers :get_node_config (Config , 0 , tcp_port_amqp )},
521+ [test_resource (PTR ) || PTR <- [{P ? JIMMY , Q1 , ok },
522+ {P ? JIMMY , Q2 , ok }]]
523+ end || ConfigurationFunction <- Configurations ],
524+ ok .
525+
503526% %--------------------------------------------------------------------
504527
505528test_publish (Person , Exchange , RoutingKey , ExpectedResult ) ->
@@ -646,6 +669,22 @@ vhost_access_query_and_in_group() ->
646669vhost_access_query_nested_groups_env () ->
647670 [{vhost_access_query , {in_group_nested , " cn=admins,ou=groups,dc=rabbitmq,dc=com" }}].
648671
672+ vhost_access_query_base_env () ->
673+ [{vhost_access_query , vhost_access_query_base ()}].
674+
675+ vhost_access_query_base () ->
676+ {exists , " ou=${vhost},ou=vhosts,dc=rabbitmq,dc=com" }.
677+
678+ resource_access_query_match_gh_100 () ->
679+ [{resource_access_query ,
680+ {match , {string , " RMQ-${vhost}" }, {attribute , " ${user_dn}" , " description" }}
681+ }].
682+
683+ resource_access_query_match_query_is_string_gh_100 () ->
684+ [{resource_access_query ,
685+ {match , " RMQ-${vhost}" , {attribute , " ${user_dn}" , " description" }}
686+ }].
687+
649688resource_access_query_match () ->
650689 [{resource_access_query , {match , {string , " ${name}" },
651690 {string , " ^${username}-" }}
@@ -666,12 +705,6 @@ resource_access_query_match_query_and_re_query_are_strings() ->
666705 " ^${username}-" }
667706 }].
668707
669- vhost_access_query_base_env () ->
670- [{vhost_access_query , vhost_access_query_base ()}].
671-
672- vhost_access_query_base () ->
673- {exists , " ou=${vhost},ou=vhosts,dc=rabbitmq,dc=com" }.
674-
675708topic_access_query_base_env () ->
676709 [{topic_access_query , topic_access_query_base ()}].
677710
0 commit comments