Last active
August 29, 2015 14:24
-
-
Save odyssey4me/50d7f61c8d4e3c7bb4c7 to your computer and use it in GitHub Desktop.
Getting an ADFS Token for a Shibboleth SP
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" | |
xmlns:a="http://www.w3.org/2005/08/addressing" | |
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> | |
<s:Header> | |
<a:Action s:mustUnderstand="1">http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue</a:Action> | |
<a:To s:mustUnderstand="1">ADFS_IDP_ADDRESS/adfs/services/trust/13/UsernameMixed</a:To> | |
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" > | |
<o:UsernameToken u:Id="uuid-6a13a244-dac6-42c1-84c5-cbb345b0c4c4-1"> | |
<o:Username>ADFS_USERNAME</o:Username> | |
<o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">ADFS_PASSWORD</o:Password> | |
</o:UsernameToken> | |
</o:Security> | |
</s:Header> | |
<s:Body> | |
<trust:RequestSecurityToken xmlns:trust="http://docs.oasis-open.org/ws-sx/ws-trust/200512"> | |
<wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"> | |
<a:EndpointReference> | |
<a:Address>SP_ENTITYID</a:Address> | |
</a:EndpointReference> | |
</wsp:AppliesTo> | |
<trust:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer</trust:KeyType> | |
<trust:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</trust:RequestType> | |
<trust:TokenType>urn:oasis:names:tc:SAML:2.0:assertion</trust:TokenType> | |
</trust:RequestSecurityToken> | |
</s:Body> | |
</s:Envelope> |
This file contains hidden or 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
#!/bin/bash | |
# ensure that the xmllint tool is installed | |
which xmllint 2>&1 > /dev/null || (apt-get update && apt-get install -y libxml2-utils) | |
# edit these before running this script | |
ADFS_IDP_ADDRESS='https://my_adfs_idp_address' | |
ADFS_USERNAME='[email protected]' | |
ADFS_PASSWORD='mysecret' | |
SP_ENTITYID='https://my_sp_address/shibboleth' | |
sed -i "s|ADFS_IDP_ADDRESS|${ADFS_IDP_ADDRESS}|" get_adfs_saml_request.xml | |
sed -i "s|ADFS_USERNAME|${ADFS_USERNAME}|" get_adfs_saml_request.xml | |
sed -i "s|ADFS_PASSWORD|${ADFS_PASSWORD}|" get_adfs_saml_request.xml | |
sed -i "s|SP_ENTITYID|${SP_ENTITYID}|" get_adfs_saml_request.xml | |
curl ${ADFS_IDP_ADDRESS}/adfs/services/trust/13/usernamemixed \ | |
--data @get_adfs_saml_request.xml \ | |
-H "Content-Type: application/soap+xml" \ | |
--verbose -o "get_adfs_saml_response.xml" | |
xmllint --format get_adfs_saml_response.xml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment