Skip to content

Instantly share code, notes, and snippets.

@hughsaunders
Created June 26, 2015 11:41
Show Gist options
  • Save hughsaunders/00a58fbb800448258dbf to your computer and use it in GitHub Desktop.
Save hughsaunders/00a58fbb800448258dbf to your computer and use it in GitHub Desktop.
K2K test
#!/bin/bash -xe
SP_HOST=134.213.145.21
IDP_HOST=134.213.146.67
SP_ID="keystone_sp"
IDP_ID="keystone-idp"
# 1) get token
eval $(openstack token issue -f shell)
OS_TOKEN=${id}
# 2) get assertion
curl -v -s -X POST \
-H "X-Auth-Token: $OS_TOKEN" -H "Content-Type: application/json" \
-d '{"auth": {"scope": {"service_provider": {"id": "'$SP_ID'"}}, "identity": {"token": {"id":"'"$OS_TOKEN"'"}, "methods": ["token"]}}}' \
http://${IDP_HOST}:5000/v3/auth/OS-FEDERATION/saml2/ecp \
> assertion
# check assertion
xmllint --pretty 1 assertion
# 3) Post assertion to sp
curl -v http://${SP_HOST}:5000/Shibboleth.sso/SAML2/ECP \
-d @assertion -k \
-H "Content-Type: application/vnd.paos+xml"\
-c cookies.txt
# 4) Request federated token
curl -v -s -X GET \
-H "Content-Type: application/vnd.paos+xml" \
-b cookies.txt \
http://${SP_HOST}:5000/v3/OS-FEDERATION/identity_providers/${IDP_ID}/protocols/saml2/auth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment