From 2580e818a6f1704b50948db66bfea4e8bf5bf70e Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Tue, 4 Oct 2022 08:43:55 +0200 Subject: [PATCH] feat(chalice): sso change --- ee/api/chalicelib/utils/SAML2_helper.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ee/api/chalicelib/utils/SAML2_helper.py b/ee/api/chalicelib/utils/SAML2_helper.py index c00081d2c..41d3781dd 100644 --- a/ee/api/chalicelib/utils/SAML2_helper.py +++ b/ee/api/chalicelib/utils/SAML2_helper.py @@ -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()) \ No newline at end of file