feat(chalice): sso change

This commit is contained in:
Taha Yassine Kraiem 2022-10-04 08:43:55 +02:00
parent 27c78cf02e
commit 2580e818a6

View file

@ -1,4 +1,5 @@
from http import cookies
from os import environ
from urllib.parse import urlparse
from decouple import config
@ -97,12 +98,14 @@ async def prepare_request(request: Request):
# add / to /acs
if not path.endswith("/"):
path = path + '/'
if not path.startswith("/api"):
path = "/api" + path
return {
'https': 'on' if proto == 'https' else 'off',
'http_host': request.headers['host'],
'server_port': url_data.port,
'script_name': "/api" + path,
'script_name': path,
'get_data': request.args.copy(),
# Uncomment if using ADFS as IdP, https://github.com/onelogin/python-saml/pull/144
# 'lowercase_urlencoding': True,
@ -123,3 +126,6 @@ def get_saml2_provider():
def get_landing_URL(jwt):
return config("SITE_URL") + config("sso_landing", default="/login?jwt=%s") % jwt
environ["hastSAML2"] = str(is_saml2_available())