Skip to content

Commit 00a7898

Browse files
Merge pull request #13645 from rabbitmq/revert-13344-issue-12545
Revert "Redirect to end_session_endpoint for idp_initiated logon when it is configured"
2 parents bde9868 + 3756775 commit 00a7898

38 files changed

+67
-376
lines changed

deps/rabbitmq_management/priv/www/js/oidc-oauth/helper.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ export function oidc_settings_from(resource_server) {
154154
automaticSilentRenew: true,
155155
revokeAccessTokenOnSignout: true
156156
}
157-
if (resource_server.oauth_end_session_endpoint != "") {
157+
if (resource_server.end_session_endpoint != "") {
158158
oidcSettings.metadataSeed = {
159-
end_session_endpoint: resource_server.oauth_end_session_endpoint
159+
end_session_endpoint: resource_server.end_session_endpoint
160160
}
161161
}
162162
if (resource_server.oauth_client_secret != "") {
@@ -214,9 +214,6 @@ export function oauth_initialize(authSettings) {
214214
if (resource_server) {
215215
oauth.sp_initiated = resource_server.sp_initiated
216216
oauth.authority = resource_server.oauth_provider_url
217-
if (resource_server.oauth_end_session_endpoint != "") {
218-
oauth.oauth_end_session_endpoint = resource_server.oauth_end_session_endpoint
219-
}
220217
if (!resource_server.sp_initiated) return oauth;
221218
else oauth_initialize_user_manager(resource_server)
222219
}
@@ -314,11 +311,7 @@ export function oauth_initiateLogout() {
314311
})
315312

316313
} else {
317-
if (oauth.oauth_end_session_endpoint != null) {
318-
location.href = oauth.oauth_end_session_endpoint
319-
}else {
320-
go_to_authority()
321-
}
314+
go_to_authority()
322315
}
323316
}
324317

deps/rabbitmq_management/src/rabbit_mgmt_wm_auth.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ oauth_provider_to_map(OAuthProvider) ->
7272
end,
7373
case OAuthProvider#oauth_provider.end_session_endpoint of
7474
undefined -> Map0;
75-
V -> maps:put(oauth_end_session_endpoint, V, Map0)
75+
V -> maps:put(end_session_endpoint, V, Map0)
7676
end.
7777

7878
skip_unknown_mgt_resource_servers(ManagementProps, OAuth2Resources) ->

deps/rabbitmq_management/test/rabbit_mgmt_wm_auth_SUITE.erl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -788,31 +788,31 @@ should_return_oauth_client_id_z(Config) ->
788788

789789
should_not_return_end_session_endpoint(Config) ->
790790
assert_attribute_not_defined_for_oauth_resource_server(authSettings(),
791-
Config, rabbit, oauth_end_session_endpoint).
791+
Config, rabbit, end_session_endpoint).
792792

793793
should_return_end_session_endpoint_0(Config) ->
794794
assertEqual_on_attribute_for_oauth_resource_server(authSettings(),
795-
Config, rabbit, oauth_end_session_endpoint, ?config(logout_url_0, Config)).
795+
Config, rabbit, end_session_endpoint, ?config(logout_url_0, Config)).
796796

797797
should_return_end_session_endpoint_1(Config) ->
798798
assertEqual_on_attribute_for_oauth_resource_server(authSettings(),
799-
Config, rabbit, oauth_end_session_endpoint, ?config(logout_url_1, Config)).
799+
Config, rabbit, end_session_endpoint, ?config(logout_url_1, Config)).
800800

801801
should_return_oauth_resource_server_a_without_end_session_endpoint(Config) ->
802802
assert_attribute_not_defined_for_oauth_resource_server(authSettings(),
803-
Config, a, oauth_end_session_endpoint).
803+
Config, a, end_session_endpoint).
804804

805805
should_return_oauth_resource_server_a_with_end_session_endpoint_0(Config) ->
806806
assertEqual_on_attribute_for_oauth_resource_server(authSettings(),
807-
Config, a, oauth_end_session_endpoint, ?config(logout_url_0, Config)).
807+
Config, a, end_session_endpoint, ?config(logout_url_0, Config)).
808808

809809
should_return_oauth_resource_server_a_with_end_session_endpoint_1(Config) ->
810810
assertEqual_on_attribute_for_oauth_resource_server(authSettings(),
811-
Config, a, oauth_end_session_endpoint, ?config(logout_url_1, Config)).
811+
Config, a, end_session_endpoint, ?config(logout_url_1, Config)).
812812

813813
should_return_oauth_resource_server_a_with_end_session_endpoint_2(Config) ->
814814
assertEqual_on_attribute_for_oauth_resource_server(authSettings(),
815-
Config, a, oauth_end_session_endpoint, ?config(logout_url_2, Config)).
815+
Config, a, end_session_endpoint, ?config(logout_url_2, Config)).
816816

817817
should_return_mgt_oauth_resource_rabbit_without_authorization_endpoint_params(Config) ->
818818
assert_attribute_not_defined_for_oauth_resource_server(authSettings(),

selenium/bin/components/fakeportal

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ ensure_fakeportal() {
1515
}
1616

1717
init_fakeportal() {
18-
FAKEPORTAL_URL=${FAKEPORTAL_URL:-https://fakeportal:3000}
19-
FAKEPORTAL_CONFIG_PATH=${FAKEPORTAL_CONFIG_PATH:-oauth/fakeportal}
20-
FAKEPORTAL_CONFIG_DIR=$(realpath ${TEST_DIR}/${FAKEPORTAL_CONFIG_PATH})
21-
18+
FAKEPORTAL_URL=${FAKEPORTAL_URL:-http://fakeportal:3000}
2219
FAKEPORTAL_DIR=${SCRIPT}/../../fakeportal
2320
CLIENT_ID="${CLIENT_ID:-rabbit_idp_user}"
2421
CLIENT_SECRET="${CLIENT_SECRET:-rabbit_idp_user}"
@@ -35,9 +32,6 @@ init_fakeportal() {
3532
print "> CLIENT_ID: ${CLIENT_ID}"
3633
print "> CLIENT_SECRET: ${CLIENT_SECRET}"
3734
print "> RABBITMQ_URL: ${RABBITMQ_URL}"
38-
39-
generate-ca-server-client-kpi fakeportal $FAKEPORTAL_CONFIG_DIR
40-
4135
}
4236
start_fakeportal() {
4337
begin "Starting fakeportal ..."
@@ -46,10 +40,6 @@ start_fakeportal() {
4640
kill_container_if_exist fakeportal
4741
mocha_test_tag=($(md5sum $SELENIUM_ROOT_FOLDER/package.json))
4842

49-
MOUNT_FAKEPORTAL_CONF_DIR=$CONF_DIR/fakeportal
50-
mkdir -p $MOUNT_FAKEPORTAL_CONF_DIR
51-
cp ${FAKEPORTAL_CONFIG_DIR}/*.pem $MOUNT_FAKEPORTAL_CONF_DIR
52-
5343
docker run \
5444
--detach \
5545
--name fakeportal \
@@ -62,8 +52,7 @@ start_fakeportal() {
6252
--env CLIENT_ID="${CLIENT_ID}" \
6353
--env CLIENT_SECRET="${CLIENT_SECRET}" \
6454
--env NODE_EXTRA_CA_CERTS=/etc/uaa/ca_uaa_certificate.pem \
65-
-v ${TEST_CONFIG_PATH}/uaa:/etc/uaa \
66-
-v ${MOUNT_FAKEPORTAL_CONF_DIR}:/etc/fakeportal \
55+
-v ${TEST_CONFIG_DIR}/uaa:/etc/uaa \
6756
-v ${FAKEPORTAL_DIR}:/code/fakeportal \
6857
mocha-test:${mocha_test_tag} run fakeportal
6958

selenium/bin/components/oauth2-proxy

Lines changed: 0 additions & 68 deletions
This file was deleted.

selenium/bin/gen-oauth2-proxy-yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

selenium/bin/suite_template

Lines changed: 11 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ tabs 1
1313
declare -i PADDING_LEVEL=0
1414
declare -i STEP=1
1515
declare -a REQUIRED_COMPONENTS
16-
declare -a INIT_ONLY_COMPONENTS
1716

1817
find_selenium_dir() {
1918
TEST_PATH=$1
@@ -113,7 +112,6 @@ init_suite() {
113112

114113
begin "Initializing suite $SUITE ..."
115114
print "> REQUIRED_COMPONENTS: ${REQUIRED_COMPONENTS[*]}"
116-
print "> INIT_ONLY_COMPONENTS: ${INIT_ONLY_COMPONENTS[*]}"
117115
print "> TEST_CASES_DIR: ${TEST_CASES_DIR} "
118116
print "> TEST_CONFIG_DIR: ${TEST_CONFIG_DIR} "
119117
print "> DOCKER_NETWORK: ${DOCKER_NETWORK} "
@@ -220,37 +218,20 @@ wait_for_oidc_endpoint_docker() {
220218
calculate_rabbitmq_url() {
221219
echo "${RABBITMQ_SCHEME:-http}://$1${PUBLIC_RABBITMQ_PATH:-$RABBITMQ_PATH}"
222220
}
223-
calculate_forward_proxy_url() {
224-
PROXIED_URL=$1
225-
PROXY_HOSTNAME=$2
226-
PROXY_PORT=$3
227-
SCHEME=$(echo "$PROXIED_URL" | cut -d: -f1)
228-
PATH=$(echo "$PROXIED_URL" | cut -d/ -f4-)
229-
echo "$SCHEME://$PROXY_HOSTNAME:$PROXY_PORT/$PATH"
230-
}
221+
231222
wait_for_url() {
232-
BASE_URL=$1
223+
BASE_URL=$1
233224
if [[ $BASE_URL == *"localhost"** ]]; then
234-
wait_for_url_local $@
225+
wait_for_url_local $BASE_URL
235226
else
236-
wait_for_url_docker $@
227+
wait_for_url_docker $BASE_URL
237228
fi
238229
}
239230
wait_for_url_local() {
240231
url=$1
241-
proxy=${2:-none}
242-
proxy_user=${3:-none}
243-
proxy_pass=$4
244-
curl_args="-L -f -v"
245232
max_retry=10
246233
counter=0
247-
if [[ "$proxy" != "none" && "$proxy" != "" ]]; then
248-
curl_args="--proxy ${proxy} ${curl_args}"
249-
fi
250-
if [[ "$proxy_user" != "none" && "$proxy_user" != "" ]]; then
251-
curl_args="--proxy-user ${proxy_user}:${proxy_pass} ${curl_args}"
252-
fi
253-
until (curl $curl_args $url >/dev/null 2>&1)
234+
until (curl -L -f -v $url >/dev/null 2>&1)
254235
do
255236
print "Waiting for $url to start (local)"
256237
sleep 5
@@ -263,14 +244,7 @@ wait_for_url_docker() {
263244
url=$1
264245
max_retry=10
265246
counter=0
266-
curl_args="-L -f -v"
267-
if [[ "$proxy" != "none" && "$proxy" != "" ]]; then
268-
curl_args="--proxy ${proxy} ${curl_args}"
269-
fi
270-
if [[ "$proxy_user" != "none" && "$proxy_user" != "" ]]; then
271-
curl_args="--proxy-user ${proxy_user}:${proxy_pass} ${curl_args}"
272-
fi
273-
until (docker run --net ${DOCKER_NETWORK} --rm curlimages/curl:7.85.0 $curl_args $url >/dev/null 2>&1)
247+
until (docker run --net ${DOCKER_NETWORK} --rm curlimages/curl:7.85.0 -L -f -v $url >/dev/null 2>&1)
274248
do
275249
print "Waiting for $url to start (docker)"
276250
sleep 5
@@ -403,8 +377,7 @@ profiles_with_local_or_docker() {
403377
generate_env_file() {
404378
begin "Generating env file ..."
405379
mkdir -p $CONF_DIR
406-
${BIN_DIR}/gen-env-file $TEST_CONFIG_DIR ${ENV_FILE}.tmp
407-
grep -v '^#' ${ENV_FILE}.tmp > $ENV_FILE
380+
${BIN_DIR}/gen-env-file $TEST_CONFIG_DIR $ENV_FILE
408381
source $ENV_FILE
409382
end "Finished generating env file."
410383
}
@@ -502,9 +475,6 @@ generate-client-keystore-if-required() {
502475
fi
503476
}
504477

505-
initOnly() {
506-
determine_init_only_components $@
507-
}
508478
run() {
509479
runWith rabbitmq
510480
}
@@ -555,12 +525,6 @@ elif [[ "$COMMAND" == "stop-rabbitmq" ]]
555525
test_local ${BASH_REMATCH[1]}
556526
fi
557527
}
558-
determine_init_only_components() {
559-
for (( i=1; i<=$#; i++)) {
560-
eval val='$'$i
561-
INIT_ONLY_COMPONENTS+=( "$val" )
562-
}
563-
}
564528
determine_required_components_including_rabbitmq() {
565529
for (( i=1; i<=$#; i++)) {
566530
eval val='$'$i
@@ -596,7 +560,7 @@ run_on_docker_with() {
596560
build_mocha_image
597561
start_selenium
598562

599-
trap "teardown_components" EXIT
563+
trap teardown_components EXIT
600564

601565
start_components
602566
test
@@ -673,27 +637,11 @@ ensure_components() {
673637
start_components() {
674638
for i in "${REQUIRED_COMPONENTS[@]}"
675639
do
676-
local ret=$(is_init_only_component $i)
677-
if [[ $ret == 1 ]]
678-
then
679-
init="init_$i"
680-
$init
681-
else
682-
start="start_$i"
683-
$start
684-
fi
685-
done
686-
}
687-
is_init_only_component() {
688-
for i in "${INIT_ONLY_COMPONENTS[@]}"
689-
do
690-
if [[ $i == $1 ]]
691-
then
692-
return 1
693-
fi
640+
start="start_$i"
641+
$start
694642
done
695-
return 0
696643
}
644+
697645
teardown_components() {
698646
skip_rabbitmq=${1:-false}
699647

0 commit comments

Comments
 (0)