@@ -74,8 +74,13 @@ groups() ->
7474 should_return_disabled_auth_settings ,
7575 {with_mgt_oauth_client_id_z , [], [
7676 should_return_mgt_oauth_provider_url_url1 ,
77+ should_return_mgt_oauth_metadata_url_url1 ,
7778 {with_mgt_oauth_provider_url_url0 , [], [
78- should_return_mgt_oauth_provider_url_url0
79+ should_return_mgt_oauth_provider_url_url0 ,
80+ should_return_mgt_oauth_metadata_url_url1 ,
81+ {with_mgt_oauth_metadata_url_url0 , [], [
82+ should_return_mgt_oauth_metadata_url_url0
83+ ]}
7984 ]}
8085 ]}
8186 ]}
@@ -299,10 +304,15 @@ init_per_suite(Config) ->
299304 {idp2 , <<" idp2" >>},
300305 {idp3 , <<" idp3" >>},
301306 {idp1_url , <<" https://idp1" >>},
307+ {idp1_meta_url , <<" https://idp1/.well-known/openid-configuration" >>},
302308 {idp2_url , <<" https://idp2" >>},
309+ {idp2_meta_url , <<" https://idp2/.well-known/openid-configuration" >>},
303310 {idp3_url , <<" https://idp3" >>},
311+ {idp3_meta_url , <<" https://idp3/.well-known/openid-configuration" >>},
304312 {url0 , <<" https://url0" >>},
313+ {meta_url0 , <<" https://url0/.well-known/openid-configuration" >>},
305314 {url1 , <<" https://url1" >>},
315+ {meta_url1 , <<" https://url1/.well-known/openid-configuration" >>},
306316 {logout_url_0 , <<" https://logout_0" >>},
307317 {logout_url_1 , <<" https://logout_1" >>},
308318 {logout_url_2 , <<" https://logout_2" >>},
@@ -340,6 +350,9 @@ init_per_group(with_mgt_oauth_client_secret_q, Config) ->
340350init_per_group (with_mgt_oauth_provider_url_url0 , Config ) ->
341351 application :set_env (rabbitmq_management , oauth_provider_url , ? config (url0 , Config )),
342352 Config ;
353+ init_per_group (with_mgt_oauth_metadata_url_url0 , Config ) ->
354+ application :set_env (rabbitmq_management , oauth_metadata_url , ? config (meta_url0 , Config )),
355+ Config ;
343356init_per_group (with_root_issuer_url1 , Config ) ->
344357 application :set_env (rabbitmq_auth_backend_oauth2 , issuer , ? config (url1 , Config )),
345358 Config ;
@@ -542,6 +555,14 @@ should_return_mgt_oauth_provider_url_url1(Config) ->
542555 assertEqual_on_attribute_for_oauth_resource_server (rabbit_mgmt_wm_auth :authSettings (),
543556 Config , rabbit , oauth_provider_url , url1 ).
544557
558+ should_return_mgt_oauth_metadata_url_url1 (Config ) ->
559+ assertEqual_on_attribute_for_oauth_resource_server (rabbit_mgmt_wm_auth :authSettings (),
560+ Config , rabbit , oauth_metadata_url , meta_url1 ).
561+
562+ should_return_mgt_oauth_metadata_url_url0 (Config ) ->
563+ assertEqual_on_attribute_for_oauth_resource_server (rabbit_mgmt_wm_auth :authSettings (),
564+ Config , rabbit , oauth_metadata_url , meta_url0 ).
565+
545566should_return_mgt_oauth_provider_url_url0 (Config ) ->
546567 assertEqual_on_attribute_for_oauth_resource_server (rabbit_mgmt_wm_auth :authSettings (),
547568 Config , rabbit , oauth_provider_url , url0 ).
@@ -585,6 +606,10 @@ should_return_oauth_resource_server_rabbit_with_oauth_provider_url_url1(Config)
585606 assertEqual_on_attribute_for_oauth_resource_server (rabbit_mgmt_wm_auth :authSettings (),
586607 Config , rabbit , oauth_provider_url , url1 ).
587608
609+ should_return_oauth_resource_server_rabbit_with_oauth_metadata_url_url1 (Config ) ->
610+ assertEqual_on_attribute_for_oauth_resource_server (rabbit_mgmt_wm_auth :authSettings (),
611+ Config , rabbit , oauth_provider_url , url1 ).
612+
588613should_return_oauth_resource_server_rabbit_with_oauth_provider_url_url0 (Config ) ->
589614 assertEqual_on_attribute_for_oauth_resource_server (rabbit_mgmt_wm_auth :authSettings (),
590615 Config , rabbit , oauth_provider_url , url0 ).
@@ -617,9 +642,9 @@ should_not_return_oauth_scopes(_Config) ->
617642
618643should_return_oauth_enabled (_Config ) ->
619644 Actual = rabbit_mgmt_wm_auth :authSettings (),
620- log (Actual ),
621645 ? assertEqual (true , proplists :get_value (oauth_enabled , Actual )).
622646
647+
623648should_return_oauth_idp_initiated_logon (_Config ) ->
624649 Actual = rabbit_mgmt_wm_auth :authSettings (),
625650 ? assertEqual (<<" idp_initiated" >>, proplists :get_value (oauth_initiated_logon_type , Actual )).
@@ -699,6 +724,12 @@ assertEqual_on_attribute_for_oauth_resource_server(Actual, Config, ConfigKey, At
699724 end ,
700725 ? assertEqual (Value , proplists :get_value (Attribute , OauthResource )).
701726
727+ assert_attribute_is_defined_for_oauth_resource_server (Actual , Config , ConfigKey , Attribute ) ->
728+ log (Actual ),
729+ OAuthResourceServers = proplists :get_value (oauth_resource_servers , Actual ),
730+ OauthResource = maps :get (? config (ConfigKey , Config ), OAuthResourceServers ),
731+ ? assertEqual (true , proplists :is_defined (Attribute , OauthResource )).
732+
702733assert_attribute_not_defined_for_oauth_resource_server (Actual , Config , ConfigKey , Attribute ) ->
703734 log (Actual ),
704735 OAuthResourceServers = proplists :get_value (oauth_resource_servers , Actual ),
0 commit comments