Skip to content

Commit 8b5dafb

Browse files
Prepare all scripts to deploy spring
authorization server
1 parent e523bde commit 8b5dafb

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

selenium/bin/components/spring

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
3+
SPRING_DOCKER_IMAGE=pivotalrabbitmq/spring-authorization-server
4+
5+
ensure_spring() {
6+
if docker ps | grep spring &> /dev/null; then
7+
print "spring already running ..."
8+
else
9+
start_spring
10+
fi
11+
}
12+
init_spring() {
13+
SPRING_CONFIG_PATH=${SPRING_CONFIG_PATH:-oauth/spring}
14+
SPRING_CONFIG_DIR=$(realpath ${TEST_DIR}/${SPRING_CONFIG_PATH})
15+
SPRING_URL=${SPRING_URL:-OAUTH_PROVIDER_URL}
16+
17+
print "> SPRING_CONFIG_DIR: ${SPRING_CONFIG_DIR}"
18+
print "> SPRING_URL: ${SPRING_URL}"
19+
print "> SPRING_DOCKER_IMAGE: ${SPRING_DOCKER_IMAGE}"
20+
21+
generate-ca-server-client-kpi spring $SPRING_CONFIG_DIR
22+
23+
}
24+
start_spring() {
25+
begin "Starting spring ..."
26+
27+
init_spring
28+
kill_container_if_exist spring
29+
30+
MOUNT_SPRING_CONF_DIR=$CONF_DIR/spring
31+
32+
mkdir -p $MOUNT_SPRING_CONF_DIR
33+
# ${BIN_DIR}/gen-spring-yml ${SPRINGCONFIG_DIR} "test-realm" $ENV_FILE $MOUNT_KEYCLOAK_CONF_DIR/test-realm.json
34+
print "> EFFECTIVE SPRING_CONFIG_FILE: $MOUNT_SPRING_CONF_DIR/application.yml"
35+
cp ${SPRING_CONFIG_DIR}/*.pem $MOUNT_SPRING_CONF_DIR
36+
37+
docker run \
38+
--detach \
39+
--name spring \
40+
--net ${DOCKER_NETWORK} \
41+
--publish 8081:8080 \
42+
--publish 8443:8443 \
43+
-v ${MOUNT_SPRING_CONF_DIR}:/opt/spring/data/import/ \
44+
${SPRING_DOCKER_IMAGE}
45+
46+
wait_for_oidc_endpoint spring $SPRING_URL $MOUNT_SPRING_CONF_DIR/ca_spring_certificate.pem
47+
end "spring is ready"
48+
49+
}

selenium/bin/gen-spring-yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3+
4+
#set -x
5+
6+
SPRING_PATH=${1:?First parameter is the directory env and config files are relative to}
7+
ENV_FILE=${2:?Second parameter is a comma-separated list of .env file which has exported template variables}
8+
FINAL_CONFIG_FILE=${3:?Forth parameter is the name of the final config file. It is relative to where this script is run from}
9+
10+
source $ENV_FILE
11+
12+
parentdir="$(dirname "$FINAL_CONFIG_FILE")"
13+
mkdir -p $parentdir
14+
15+
echo "" > $FINAL_CONFIG_FILE
16+
17+
for f in $($SCRIPT/find-template-files "${PROFILES}" $SPRING_PATH "application" "yml")
18+
do
19+
envsubst < $f >> $FINAL_CONFIG_FILE
20+
done
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
5+
TEST_CASES_PATH=/oauth/with-sp-initiated
6+
TEST_CONFIG_PATH=/oauth
7+
PROFILES="spring-authz-server spring-oauth-provider spring-mgt-oauth-provider tls"
8+
9+
source $SCRIPT/../../bin/suite_template $@
10+
runWith spring-authz-server

0 commit comments

Comments
 (0)