From 2a7a10178c13e62caf27c9361c9cadc3fbeccab2 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Tue, 2 Apr 2024 13:24:55 +0200 Subject: [PATCH] fix https --- ereuse_devicehub/modules/oidc/views.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ereuse_devicehub/modules/oidc/views.py b/ereuse_devicehub/modules/oidc/views.py index 33a664fd..2a18b795 100644 --- a/ereuse_devicehub/modules/oidc/views.py +++ b/ereuse_devicehub/modules/oidc/views.py @@ -141,8 +141,12 @@ class SelectInventoryView(GenericMixin): # url += f"response_uri=https://{host}/allow_code_oidc4vp" # url += "&state=1700822573400&response_type=vp_token&response_mode=direct_post" url = app.config.get('VERIFY_URL') - url += f"?response_uri=http://{host}:5000/allow_code_oidc4vp" - url += '&presentation_definition=["EOperatorClaim"]' + if host == "localhost": + url += f"?response_uri=http://{host}:5000/allow_code_oidc4vp" + url += '&presentation_definition=["EOperatorClaim"]' + else: + url += f"?response_uri=https://{host}/allow_code_oidc4vp" + url += '&presentation_definition=["EOperatorClaim"]' session['next_url'] = next @@ -264,7 +268,13 @@ class AllowCodeOidc4vpView(GenericMixin): db.session.add(code) db.session.commit() - url = "http://{host}:5000/allow_code_oidc4vp2?code={code}".format( + host = app.config.get('HOST') + if host == "localhost": + url_init = "http://{host}:5000/allow_code_oidc4vp2?code={code}" + else: + url_init = "https://{host}/allow_code_oidc4vp2?code={code}" + + url = url_init.format( host=app.config.get('HOST'), code=code.code )