Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
VR-demos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nomad-lab
VR-demos
Commits
6d53da97
Commit
6d53da97
authored
7 years ago
by
Ruben Jesus Garcia Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Changes to add authentification to the encyclopedia.
Changes to support latest apache2 and curl.
parent
4caea0f8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
webserver/cgi-bin/NOMAD/material
+49
-7
49 additions, 7 deletions
webserver/cgi-bin/NOMAD/material
with
49 additions
and
7 deletions
webserver/cgi-bin/NOMAD/material
+
49
−
7
View file @
6d53da97
#!/bin/bash
#!/bin/bash
if
[
"
$QUERY_STRING
"
eq
""
]
if
[
[
"
$QUERY_STRING
"
-
eq
""
]
]
then
then
#echo Location: /NOMAD/
#echo Location: /NOMAD/
echo
Location:http://mrs-srv.srv.lrz.de/NOMAD/
echo
Location:http://mrs-srv.srv.lrz.de/NOMAD/
echo
''
echo
''
else
else
#rgh: text/plain works in pc but android chrome saves it as .txt, removing the extension
#rgh: text/plain works in pc but android chrome saves it as .txt, removing the extension
# export TOKEN=`cat t.b64`
export
MAT
=
$QUERY_STRING
export
RAND
=
$RANDOM
#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
http://encyclopedia-api.nomad-coe.eu/v1.0/saml/
-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
"https://idp.nomad-coe.eu
$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
"https://idp.nomad-coe.eu
$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)
#RELAY="https%3A%2F%2Fencyclopedia-api.nomad-coe.eu%2Fv1.0%2Fsaml%2F"
RELAY
=
"https://encyclopedia-api.nomad-coe.eu/v1.0/saml/"
#echo relay is $RELAY
curl
-L
-c
cookies3.txt
-X
GET
-F
"RelayState=
$RELAY
"
-F
"SAMLResponse=
$SAML
"
"https://encyclopedia-api.nomad-coe.eu/v1.0/saml/?acs"
-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
""
https://encyclopedia-api.nomad-coe.eu/v1.0/materials/
$MAT
/cells?pagination
=
off
-O
material_cells.json
>
/dev/null 2>&1
wget
--no-check-certificate
--user
"
$TOKEN
"
--password
""
https://encyclopedia-api.nomad-coe.eu/v1.0/materials/
$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-type: application/octet-stream"
echo
"Content-disposition: attachment; filename=
${
QUERY_STRING
}
.
ncfg
"
echo
"Content-disposition: attachment; filename=
${
QUERY_STRING
}
.
zip
"
echo
''
echo
''
echo
\#
Material
$QUERY_STRING
cat
$MAT
.zip
echo
baseurl
\"
http://enc-testing-nomad.esc.rzg.mpg.de/v1.0/materials/
\"
cd
..
echo
jsonurl
\"
$QUERY_STRING
\"
# \rm -r $RAND
echo
background 0 0 0
echo
atomscaling 0.5
fi
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment