Commit c9f36a4e authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fix saml issues after domain name changes.

parent 07f4167b
......@@ -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())
......
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