Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
midPoint_container/demo/shibboleth/tests/main.bats
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
69 lines (56 sloc)
2.48 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bats | |
load ../../../common | |
load ../../../library | |
@test "000 Cleanup before running the tests" { | |
cd ../simple ; docker-compose down -v ; true | |
run docker-compose down -v | |
} | |
@test "010 Initialize and start containers" { | |
docker-compose -f docker-compose-tests.yml build --pull midpoint_data directory idp | |
# Sometimes the tier/midpoint:xyz is not yet in the repository, causing issues with --pull | |
docker-compose -f docker-compose-tests.yml build midpoint_server | |
docker-compose -f docker-compose-tests.yml up -d | |
} | |
@test "012 Wait for Shibboleth to start up" { | |
wait_for_shibboleth_idp_start shibboleth_idp_1 | |
} | |
@test "014 Wait for midPoint to start up" { | |
wait_for_midpoint_start shibboleth_midpoint_server_1 | |
} | |
@test "030 Check health (midPoint)" { | |
# docker logs shibboleth_midpoint_server_1 | |
check_health | |
} | |
@test "035 Check health (Shibboleth IdP)" { | |
check_health_shibboleth_idp | |
} | |
@test "040 Check internal SAML redirection (/midpoint/auth/saml-internal)" { | |
curl -k --write-out %{redirect_url} --silent --output /dev/null https://localhost:8443/midpoint/auth/saml-internal/ | grep 'https:\/\/localhost:8443\/midpoint\/auth\/saml-internal\/mySamlSso\/discovery?idp=https%3A%2F%2Fidptestbed%2Fidp%2Fshibboleth' | |
} | |
@test "041 Check internal SAML redirection action (midpoint/..../discovery?...)" { | |
TMPFILE=$(mktemp /tmp/samlForm.XXXXXX) | |
curl -k https://localhost:8443/midpoint/auth/saml-internal/mySamlSso/discovery?idp=https://idptestbed/idp/shibboleth >$TMPFILE || (rm $TMPFILE ; return 1) | |
if (grep -q "<input type=\"hidden\" name=\"SAMLRequest\"" <$TMPFILE); then | |
echo "SAML REQUEST is OK" | |
rm $TMPFILE | |
return 0 | |
else | |
echo "SAML Request was not found or not retrieved correctly:" | |
cat $TMPFILE | |
rm $TMPFILE | |
return 1 | |
fi | |
} | |
@test "044 Check Shibboleth redirection (/midpoint/)" { | |
curl -k --write-out %{redirect_url} --silent https://localhost:8443/midpoint/ | grep 'https:\/\/localhost:8443\/midpoint\/auth\/shib' | |
} | |
@test "045 Check Shibboleth redirection (/midpoint/auth/shib/)" { | |
curl -k --write-out %{redirect_url} --silent --output /dev/null https://localhost:8443/midpoint/auth/shib/ | grep 'https:\/\/localhost\/idp\/profile\/SAML2\/Redirect\/SSO?SAMLRequest=' | |
} | |
@test "100 Check internally-authenticated REST call: get 'administrator'" { | |
check_health | |
get_and_check_object users 00000000-0000-0000-0000-000000000002 administrator | |
} | |
@test "999 Clean up" { | |
docker-compose down -v | |
} |