mirror of
https://github.com/unikent-ms1/simple-soap-ecp-test.git
synced 2025-01-22 09:19:59 +00:00
dcc6918a03
Of course the question now is: does Microsoft use the right mime type?
30 lines
715 B
Bash
Executable File
30 lines
715 B
Bash
Executable File
#!/bin/bash
|
|
|
|
### Simple SOAP ECP Test
|
|
|
|
TEMPLATE=template.xml
|
|
NOW=$(date -u '+%FT%H:%M:%SZ')
|
|
ID=$(echo "${NOW}-$$" | shasum | cut -d ' ' -f 1)
|
|
ENTITYID=${ENTITYID:-urn:federation:MicrosoftOnline}
|
|
ENDPOINT=${ENDPOINT:-https://login.microsoftonline.com/login.srf}
|
|
URL=${URL:-http://localhost/}
|
|
|
|
CRED=${CRED:-anonymous:anonymous}
|
|
|
|
ENDPOINT_ESCAPED="$(echo $ENDPOINT | sed -e 's/[\/&]/\\&/g')"
|
|
|
|
REQUEST=$(cat $TEMPLATE |
|
|
sed "s/__NOW__/$NOW/" |
|
|
sed "s/__RANDOM_STRING__/$ID/" |
|
|
sed "s/__REMOTE_ENTITYID__/$ENTITYID/" |
|
|
sed "s/__AssertionConsumerServiceURL__/$ENDPOINT_ESCAPED/")
|
|
|
|
echo $REQUEST | xmllint --pretty 1 -
|
|
|
|
echo $REQUEST |
|
|
curl -k \
|
|
-d @- \
|
|
-H "Content-Type: text/xml" \
|
|
--basic -u $CRED \
|
|
$URL
|