@@ -20,6 +20,7 @@ all() ->
20
20
{group , verify_mgt_oauth_provider_url_with_single_resource },
21
21
{group , verify_mgt_oauth_provider_url_with_single_resource_and_another_resource },
22
22
{group , verify_end_session_endpoint_with_single_resource },
23
+ {group , verify_end_session_endpoint_with_single_resource_and_another_resource },
23
24
{group , verify_oauth_initiated_logon_type_for_sp_initiated },
24
25
{group , verify_oauth_initiated_logon_type_for_idp_initiated },
25
26
{group , verify_oauth_disable_basic_auth },
@@ -129,6 +130,38 @@ groups() ->
129
130
]}
130
131
]}
131
132
]},
133
+ {verify_end_session_endpoint_with_single_resource_and_another_resource , [], [
134
+ {with_resource_server_id_rabbit , [], [
135
+ {with_resource_server_a , [], [
136
+ {with_root_issuer_url1 , [], [
137
+ {with_oauth_enabled , [], [
138
+ should_return_disabled_auth_settings ,
139
+ {with_mgt_oauth_client_id_z , [], [
140
+ should_not_return_end_session_endpoint ,
141
+ should_return_oauth_resource_server_a_without_end_session_endpoint ,
142
+ {with_root_end_session_endpoint_0 , [], [
143
+ should_return_end_session_endpoint_0 ,
144
+ should_return_oauth_resource_server_a_with_end_session_endpoint_0
145
+ ]},
146
+ {with_oauth_providers_idp1_idp2 , [], [
147
+ {with_default_oauth_provider_idp1 , [], [
148
+ {with_end_session_endpoint_for_idp1_1 , [], [
149
+ should_return_end_session_endpoint_1 ,
150
+ should_return_oauth_resource_server_a_with_end_session_endpoint_1 ,
151
+ {with_oauth_provider_idp2_for_resource_server_a , [], [
152
+ {with_end_session_endpoint_for_idp2_2 , [], [
153
+ should_return_oauth_resource_server_a_with_end_session_endpoint_2
154
+ ]}
155
+ ]}
156
+ ]}
157
+ ]}
158
+ ]}
159
+ ]}
160
+ ]}
161
+ ]}
162
+ ]}
163
+ ]}
164
+ ]},
132
165
{verify_mgt_oauth_provider_url_with_single_resource_and_another_resource , [], [
133
166
{with_resource_server_id_rabbit , [], [
134
167
{with_resource_server_a , [], [
@@ -272,6 +305,7 @@ init_per_suite(Config) ->
272
305
{url1 , <<" https://url1" >>},
273
306
{logout_url_0 , <<" https://logout_0" >>},
274
307
{logout_url_1 , <<" https://logout_1" >>},
308
+ {logout_url_2 , <<" https://logout_2" >>},
275
309
{a , <<" a" >>},
276
310
{b , <<" b" >>},
277
311
{q , <<" q" >>},
@@ -371,6 +405,15 @@ init_per_group(with_end_session_endpoint_for_idp1_1, Config) ->
371
405
set_attribute_in_entry_for_env_variable (rabbitmq_auth_backend_oauth2 , oauth_providers ,
372
406
? config (idp1 , Config ), end_session_endpoint , ? config (logout_url_1 , Config )),
373
407
Config ;
408
+ init_per_group (with_end_session_endpoint_for_idp2_2 , Config ) ->
409
+ set_attribute_in_entry_for_env_variable (rabbitmq_auth_backend_oauth2 , oauth_providers ,
410
+ ? config (idp2 , Config ), end_session_endpoint , ? config (logout_url_2 , Config )),
411
+ Config ;
412
+
413
+ init_per_group (with_oauth_provider_idp2_for_resource_server_a , Config ) ->
414
+ set_attribute_in_entry_for_env_variable (rabbitmq_auth_backend_oauth2 , resource_servers ,
415
+ ? config (a , Config ), oauth_provider_id , ? config (idp2 , Config )),
416
+ Config ;
374
417
375
418
init_per_group (_ , Config ) ->
376
419
Config .
@@ -459,6 +502,15 @@ end_per_group(with_end_session_endpoint_for_idp1_1, Config) ->
459
502
remove_attribute_from_entry_from_env_variable (rabbitmq_auth_backend_oauth2 , oauth_providers ,
460
503
? config (idp1 , Config ), end_session_endpoint ),
461
504
Config ;
505
+ end_per_group (with_end_session_endpoint_for_idp2_2 , Config ) ->
506
+ remove_attribute_from_entry_from_env_variable (rabbitmq_auth_backend_oauth2 , oauth_providers ,
507
+ ? config (idp2 , Config ), end_session_endpoint ),
508
+ Config ;
509
+ end_per_group (with_oauth_provider_idp2_for_resource_server_a , Config ) ->
510
+ remove_attribute_from_entry_from_env_variable (rabbitmq_auth_backend_oauth2 , resource_servers ,
511
+ ? config (a , Config ), oauth_provider_id ),
512
+ Config ;
513
+
462
514
end_per_group (_ , Config ) ->
463
515
Config .
464
516
@@ -589,15 +641,28 @@ should_not_return_end_session_endpoint(Config) ->
589
641
Config , rabbit , end_session_endpoint ).
590
642
591
643
should_return_end_session_endpoint_0 (Config ) ->
592
- ct :log (" settings: ~p " , [rabbit_mgmt_wm_auth :authSettings ()]),
593
644
assertEqual_on_attribute_for_oauth_resource_server (rabbit_mgmt_wm_auth :authSettings (),
594
645
Config , rabbit , end_session_endpoint , ? config (logout_url_0 , Config )).
595
646
596
647
should_return_end_session_endpoint_1 (Config ) ->
597
- ct :log (" settings: ~p " , [rabbit_mgmt_wm_auth :authSettings ()]),
598
648
assertEqual_on_attribute_for_oauth_resource_server (rabbit_mgmt_wm_auth :authSettings (),
599
649
Config , rabbit , end_session_endpoint , ? config (logout_url_1 , Config )).
600
650
651
+ should_return_oauth_resource_server_a_without_end_session_endpoint (Config ) ->
652
+ assert_attribute_not_defined_for_oauth_resource_server (rabbit_mgmt_wm_auth :authSettings (),
653
+ Config , a , end_session_endpoint ).
654
+
655
+ should_return_oauth_resource_server_a_with_end_session_endpoint_0 (Config ) ->
656
+ assertEqual_on_attribute_for_oauth_resource_server (rabbit_mgmt_wm_auth :authSettings (),
657
+ Config , a , end_session_endpoint , ? config (logout_url_0 , Config )).
658
+
659
+ should_return_oauth_resource_server_a_with_end_session_endpoint_1 (Config ) ->
660
+ assertEqual_on_attribute_for_oauth_resource_server (rabbit_mgmt_wm_auth :authSettings (),
661
+ Config , a , end_session_endpoint , ? config (logout_url_1 , Config )).
662
+
663
+ should_return_oauth_resource_server_a_with_end_session_endpoint_2 (Config ) ->
664
+ assertEqual_on_attribute_for_oauth_resource_server (rabbit_mgmt_wm_auth :authSettings (),
665
+ Config , a , end_session_endpoint , ? config (logout_url_2 , Config )).
601
666
602
667
% % -------------------------------------------------------------------
603
668
% % Utility/helper functions
@@ -647,7 +712,9 @@ assert_not_defined_oauth_resource_server(Actual, Config, ConfigKey) ->
647
712
648
713
set_attribute_in_entry_for_env_variable (Application , EnvVar , Key , Attribute , Value ) ->
649
714
Map = application :get_env (Application , EnvVar , #{}),
715
+ ct :log (" set_attribute_in_entry_for_env_variable before ~p " , [Map ]),
650
716
Map1 = maps :put (Key , [ { Attribute , Value } | maps :get (Key , Map , []) ], Map ),
717
+ ct :log (" set_attribute_in_entry_for_env_variable after ~p " , [Map1 ]),
651
718
application :set_env (Application , EnvVar , Map1 ).
652
719
653
720
log (AuthSettings ) ->
0 commit comments