Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
encyclopedia-physics-engine
Commits
c9f36a4e
Commit
c9f36a4e
authored
Oct 10, 2018
by
Markus Scheidgen
Browse files
Fix saml issues after domain name changes.
parent
07f4167b
Changes
1
Hide whitespace changes
Inline
Side-by-side
rest-api-service/app/api_v1_0/routes.py
View file @
c9f36a4e
...
...
@@ -687,7 +687,9 @@ def index():
# based on machine's hostname use different base URL for redirection
# TODO switch to use environment variables: PRODUCTION, TESTING, DEVELOPMENT
if
hostname
==
'enc-production-nomad'
:
return_to
=
'https://encyclopedia-gui.nomad-coe.eu/'
return_to
=
'https://encyclopedia.nomad-coe.eu/gui'
elif
hostname
==
'enc-production-hv-nomad'
:
return_to
=
'https://encyclopedia.nomad-coe.eu/gui/'
else
:
return_to
=
'%sgui/'
%
request
.
host_url
# return_to = '%sgui/' % request.host_url
...
...
@@ -739,7 +741,7 @@ def index():
"expires_in"
:
session
[
'token_expires_in'
]}}
# production and staging machines have different domain names
# and the cookie should be set on the corresponding domain name
if
hostname
==
'enc-production-nomad'
:
if
hostname
==
'enc-production-nomad'
or
hostname
==
'enc-production-hv-nomad'
:
response
.
set_cookie
(
'user_info'
,
json
.
dumps
(
cookie_data
),
domain
=
'.nomad-coe.eu'
)
else
:
response
.
set_cookie
(
'user_info'
,
json
.
dumps
(
cookie_data
),
domain
=
'.mpg.de'
)
...
...
@@ -789,7 +791,10 @@ def index():
# paint_logout=paint_logout
# )
if
'samlUserdata'
in
session
:
return
redirect
(
url_for
(
'api.user_attrs'
))
# Added 'api' string as a quick fix for redirection to /saml/user/ after the user is authenticated.
# Before the fix the url was domain.com/v1.0/saml/user/ which doesn't exists (because should be
# domain.com/api/v1.0/saml/user/) and nginx redirected to the /gui and not showing the user's details, token ...
return
redirect
(
'api'
+
url_for
(
'api.user_attrs'
))
else
:
return
redirect
(
auth
.
login
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment