Changes to add authentification to the encyclopedia.

Changes to support latest apache2 and curl.
parent 4caea0f8
if ["$QUERY_STRING" eq ""]
if [[ "$QUERY_STRING" -eq "" ]]
#echo Location: /NOMAD/
echo Location:
echo ''
#rgh: text/plain works in pc but android chrome saves it as .txt, removing the extension
# export TOKEN=`cat t.b64`
#rgh: before end of september 2017, use /var/tmp, after, use /tmp (apache update)
cd /tmp
/usr/bin/mkdir $RAND
cd $RAND
wget --save-cookies cookies.txt \
--keep-session-cookies \
--no-check-certificate -O login.html >/dev/null 2>&1
URL=`grep "form action" login.html |cut -f 2 -d \" |head -n 1`
wget --save-cookies cookies2.txt --keep-session-cookies --load-cookies cookies.txt --no-check-certificate "$URL&j_username=vrconfigurator&j_password=iFOCkuwxZC6i&_eventId_proceed" -O a.html >/dev/null 2>&1
URL=`grep "form action" a.html |cut -f 2 -d \" |head -n 1`
wget --save-cookies cookies3.txt --keep-session-cookies --load-cookies cookies2.txt --no-check-certificate "$URL&_shib_idp_consentOptions=_shib_idp_globalConsent&_eventId_proceed" -O b.html >/dev/null 2>&1
#now continue, as we don't support javascript :o)
URL2=`echo $URL |cut -f 1 -d \?`
DEST=`grep action b.html |cut -f 2 -d \"`
RELAY=`grep RelayState b.html |cut -f6 -d \"`
SAML=`grep SAMLResponse b.html |cut -f6 -d \"`
#rgh: since 25-09-2017, this line gives "invalid url" (possibly curl update)
#echo relay is $RELAY
curl -L -c cookies3.txt -X GET -F "RelayState=$RELAY" -F "SAMLResponse=$SAML" "" -o resp.json >/dev/null 2>&1
TOKEN=`grep data resp.json |cut -f 4 -d \"`
mkdir $MAT
cd $MAT
wget --no-check-certificate --user "$TOKEN" --password ""$MAT/cells?pagination=off -O material_cells.json >/dev/null 2>&1
wget --no-check-certificate --user "$TOKEN" --password ""$MAT/elements?pagination=off -O material_elements.json >/dev/null 2>&1
echo \# Material $QUERY_STRING >> $MAT.ncfg
echo background 0 0 0 >> $MAT.ncfg
echo atomscaling 0.5 >> $MAT.ncfg
echo json material >> $MAT.ncfg
cd ..
zip -r $MAT $MAT >/dev/null 2>&1
echo "Content-type: application/octet-stream"
echo "Content-disposition: attachment; filename=${QUERY_STRING}.ncfg"
echo "Content-disposition: attachment; filename=${QUERY_STRING}.zip"
echo ''
echo \# Material $QUERY_STRING
echo baseurl \"\"
echo jsonurl \"$QUERY_STRING\"
echo background 0 0 0
echo atomscaling 0.5
cat $
cd ..
# \rm -r $RAND
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment