Skip to content

Commit

Permalink
build: modification de la ci pour les tests SAML
Browse files Browse the repository at this point in the history
  • Loading branch information
nathancailbourdin committed Sep 10, 2024
1 parent 6e1e746 commit 396c41c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
5 changes: 4 additions & 1 deletion puppeteer/cas.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ exports.loge = async (text) => {
exports.loginWith = async (page, casHost, service, username, password) => {
// Go to login page
await page.goto(`${casHost}/cas/login?service=${service}`);
await this.typeCredentialsAndEnter(page, username, password);
return page.waitForNavigation();
};

exports.typeCredentialsAndEnter = async (page, username, password) => {
// Type credentials
await page.waitForSelector("#username", {visible: true});
await page.$eval("#username", el => el.value = '');
Expand All @@ -49,7 +53,6 @@ exports.loginWith = async (page, casHost, service, username, password) => {

// Validate credentials and send request to CAs
await page.keyboard.press('Enter');
return page.waitForNavigation();
};

exports.verifyTGC = async (client) => {
Expand Down
21 changes: 15 additions & 6 deletions puppeteer/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,17 @@ fi
echo -n "NPM version: " && npm --version
echo -n "Node version: " && node --version

# Installation des dépendances python
cd "${ROOT_DIRECTORY}"
pip install -r ci/python/flask-saml-client/requirements.txt

# Démarrage des dockers redis et ldap
cd "${ROOT_DIRECTORY}/ci/ldap"
./run-ldap.sh
cd "${ROOT_DIRECTORY}/ci/redis"
./start-all.sh
# Démarrage du serveur python

# Démarrage des serveurs python
cd "${ROOT_DIRECTORY}/ci/python"
python3 service_test1.py &
pid_python_service_test1=$!
Expand All @@ -78,21 +83,24 @@ python3 structs_info_api.py &
pid_python_structs_info_api=$!
python3 externalid_api.py &
pid_python_externalid_api=$!
cd "flask-saml-client"
python3 index.py &
cd "${ROOT_DIRECTORY}"

# Lancement du serveur CAS grâce au war qu'on a construit plus haut
echo "Launching CAS at $casWebApplicationFile with options $CAS_ARGS"
java -jar "$casWebApplicationFile" $CAS_ARGS &
pid_cas=$!
echo "Waiting for CAS under process id ${pid}"
sleep 45
echo "Waiting for CAS under process id ${pid_cas}"
# Attention à avoir un délai suffisant ici, il faut bien attendre que le serveur CAS soit démarré
sleep 60
casLogin="${PUPPETEER_CAS_HOST:-https://localhost:8443}/cas/login"
echo "Checking CAS status at ${casLogin}"
curl -k -L --output /dev/null --silent --fail "$casLogin"
if [[ $? -ne 0 ]]; then
printred "Unable to launch CAS instance under process id ${pid}."
printred "Killing process id $pid and exiting"
kill -9 "$pid"
printred "Unable to launch CAS instance under process id ${pid_cas}."
printred "Killing process id $pid_cas and exiting"
kill -9 "$pid_cas"
exit 1
fi

Expand Down Expand Up @@ -143,6 +151,7 @@ kill -9 "$pid_python_service_test2"
kill -9 "$pid_python_service_test10"
kill -9 "$pid_python_structs_info_api"
kill -9 "$pid_python_externalid_api"
ps -aux | grep "python3 index.py" | head -n 2 | awk '{print $2}' | xargs kill -9
cd "${ROOT_DIRECTORY}/ci/ldap"
./stop-ldap.sh
cd "${ROOT_DIRECTORY}/ci/redis"
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ cas.authn.ldap[0].principal-attribute-list: uid,isMemberOf,cn,sn,givenName,displ
cas.interrupt.core.force-execution: true
cas.interrupt.core.trigger-mode: AFTER_SSO

# SAML
cas.authn.saml-idp.core.entity-id: https://localhost:8443/cas/idp/metadata

# Custom Properties

# Interrupt
Expand Down

0 comments on commit 396c41c

Please sign in to comment.