Skip to content

Commit 00d34ea

Browse files
Use TLS in faekportal and fakeproxy
when getting access token from uaa over tls
1 parent 675af66 commit 00d34ea

File tree

6 files changed

+43
-31
lines changed

6 files changed

+43
-31
lines changed

selenium/bin/components/fakeportal

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
5+
if [[ ! -z "${DEBUG}" ]]; then
6+
set -x
7+
fi
18

29
ensure_fakeportal() {
310
if docker ps | grep fakeportal &> /dev/null; then
@@ -9,7 +16,7 @@ ensure_fakeportal() {
916

1017
init_fakeportal() {
1118
FAKEPORTAL_URL=${FAKEPORTAL_URL:-http://fakeportal:3000}
12-
FAKEPORTAL_DIR=${SCRIPT}/../fakeportal
19+
FAKEPORTAL_DIR=${SCRIPT}/../../fakeportal
1320
CLIENT_ID="${CLIENT_ID:-rabbit_idp_user}"
1421
CLIENT_SECRET="${CLIENT_SECRET:-rabbit_idp_user}"
1522
RABBITMQ_HOST=${RABBITMQ_HOST:-proxy:9090}
@@ -44,6 +51,8 @@ start_fakeportal() {
4451
--env UAA_URL="${UAA_URL_FOR_FAKEPORTAL}" \
4552
--env CLIENT_ID="${CLIENT_ID}" \
4653
--env CLIENT_SECRET="${CLIENT_SECRET}" \
54+
--env NODE_EXTRA_CA_CERTS=/etc/uaa/ca_uaa_certificate.pem \
55+
-v ${OAUTH_SERVER_CONFIG_DIR}:/etc/uaa \
4756
-v ${FAKEPORTAL_DIR}:/code/fakeportal \
4857
mocha-test:${mocha_test_tag} run fakeportal
4958

selenium/bin/components/fakeproxy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ start_fakeproxy() {
4343
--env UAA_URL="${UAA_URL_FOR_FAKEPROXY}" \
4444
--env CLIENT_ID="${CLIENT_ID}" \
4545
--env CLIENT_SECRET="${CLIENT_SECRET}" \
46+
--env NODE_EXTRA_CA_CERTS=/etc/uaa/ca_uaa_certificate.pem \
47+
-v ${OAUTH_SERVER_CONFIG_DIR}:/etc/uaa \
4648
-v ${FAKEPROXY_DIR}:/code/fakeportal \
4749
mocha-test:${mocha_test_tag} run fakeproxy
4850

selenium/bin/suite_template

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -437,37 +437,37 @@ generate-truststore-if-required() {
437437
generate-server-keystore-if-required() {
438438
NAME=$1
439439
FOLDER=$2
440-
if [[ ! -f "${FOLDER}/server_${NAME}.jks " ]]; then
441-
keytool -importkeystore \
442-
-destkeystore ${FOLDER}/server_${NAME}.jks \
443-
-srckeystore ${FOLDER}/server_${NAME}.p12 \
444-
-deststoretype pkcs12 \
445-
-srcstoretype pkcs12 \
446-
-alias 1 \
447-
-destalias server-${NAME}-tls \
448-
-deststorepass foobar \
449-
-destkeypass foobar \
450-
-srcstorepass "" \
451-
-srckeypass "" \
452-
-noprompt
440+
if [ ! -f "${FOLDER}/server_${NAME}.jks" ]; then
441+
keytool -importkeystore \
442+
-destkeystore ${FOLDER}/server_${NAME}.jks \
443+
-srckeystore ${FOLDER}/server_${NAME}.p12 \
444+
-deststoretype pkcs12 \
445+
-srcstoretype pkcs12 \
446+
-alias 1 \
447+
-destalias server-${NAME}-tls \
448+
-deststorepass foobar \
449+
-destkeypass foobar \
450+
-srcstorepass "" \
451+
-srckeypass "" \
452+
-noprompt
453453
fi
454454
}
455455
generate-client-keystore-if-required() {
456456
NAME=$1
457457
FOLDER=$2
458-
if [[ ! -f "${FOLDER}/client_${NAME}.jks " ]]; then
459-
keytool -importkeystore \
460-
-destkeystore ${FOLDER}/client_${NAME}.jks \
461-
-srckeystore ${FOLDER}/client_${NAME}.p12 \
462-
-deststoretype pkcs12 \
463-
-srcstoretype pkcs12 \
464-
-alias 1 \
465-
-destalias client-${NAME}-tls \
466-
-deststorepass foobar \
467-
-destkeypass foobar \
468-
-srcstorepass "" \
469-
-srckeypass "" \
470-
-noprompt
458+
if [ ! -f "${FOLDER}/client_${NAME}.jks" ]; then
459+
keytool -importkeystore \
460+
-destkeystore ${FOLDER}/client_${NAME}.jks \
461+
-srckeystore ${FOLDER}/client_${NAME}.p12 \
462+
-deststoretype pkcs12 \
463+
-srcstoretype pkcs12 \
464+
-alias 1 \
465+
-destalias client-${NAME}-tls \
466+
-deststorepass foobar \
467+
-destkeypass foobar \
468+
-srcstorepass "" \
469+
-srckeypass "" \
470+
-noprompt
471471
fi
472472
}
473473

selenium/fakeportal/app.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ function access_token(id, secret) {
5656
if (req.status == 200) {
5757
const token = JSON.parse(req.responseText).access_token;
5858
console.log("Token => " + token)
59-
return token;
59+
return token
6060
} else {
61-
throw new Error(req.status + " : " + req.responseText);
61+
throw new Error(req.status + " : " + " : " +
62+
req.response + " : " + req.responseText)
6263
}
6364
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export FAKEPORTAL_URL=http://fakeportal:3000
22
export RABBITMQ_HOST_FOR_FAKEPORTAL=${RABBITMQ_HOST}
3-
export UAA_URL_FOR_FAKEPORTAL=http://uaa:8080
3+
export UAA_URL_FOR_FAKEPORTAL=https://uaa:8443
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export FAKEPORTAL_URL=http://localhost:3000
22
export RABBITMQ_HOST_FOR_FAKEPORTAL=localhost:15672
3-
export UAA_URL_FOR_FAKEPORTAL=http://host.docker.internal:8080
3+
export UAA_URL_FOR_FAKEPORTAL=https://uaa:8443

0 commit comments

Comments
 (0)