From dca72e2219edad6e696dbb5470dc786db415d804 Mon Sep 17 00:00:00 2001 From: Noi Narisak Date: Mon, 31 Jan 2022 17:45:38 -0600 Subject: [PATCH] Fix healthcare oie profile bug (#485) Co-authored-by: noi narisak --- .env.sample | 2 ++ GlobalBehaviorandComponents/validation.py | 5 ++--- _healthcareoie/views.py | 12 ++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.env.sample b/.env.sample index 97c0ed1d..05e1af45 100644 --- a/.env.sample +++ b/.env.sample @@ -36,6 +36,8 @@ UDP_CONFIG_URL="https://api.staging.udp.unidemo.live" UDP_ISSUER="https://udp-stg.oktapreview.com/oauth2/default" UDP_CLIENT_ID="" UDP_CLIENT_SECRET="" +UDP_APP_NAME="" +UDP_SUB_DOMAIN="" # Third Party Service Setting diff --git a/GlobalBehaviorandComponents/validation.py b/GlobalBehaviorandComponents/validation.py index 2251063b..3ffd0e44 100644 --- a/GlobalBehaviorandComponents/validation.py +++ b/GlobalBehaviorandComponents/validation.py @@ -21,10 +21,9 @@ def is_authenticated(f): @wraps(f) def decorated_function(*args, **kws): logger.debug("is_authenticated()") - access_token = TokenUtil.get_access_token(request.cookies) - # logger.debug("token: {0}".format(token)) - if TokenUtil.is_valid(access_token, session[SESSION_INSTANCE_SETTINGS_KEY]): + id_token = TokenUtil.get_id_token(request.cookies) + if TokenUtil.is_valid(id_token, session[SESSION_INSTANCE_SETTINGS_KEY]): return f(*args, **kws) else: logger.debug("Access Denied") diff --git a/_healthcareoie/views.py b/_healthcareoie/views.py index dd8897c9..3ea2ec9d 100644 --- a/_healthcareoie/views.py +++ b/_healthcareoie/views.py @@ -58,7 +58,7 @@ def healthcareoie_profile(): is_evident_validated = user["profile"][get_udp_ns_fieldname("is_evident_validated")] return render_template( - "healthcare/profile.html", + "healthcareoie/profile.html", id_token=TokenUtil.get_id_token(request.cookies), access_token=TokenUtil.get_access_token(request.cookies), user_info=get_userinfo(), @@ -102,7 +102,7 @@ def healthcareoie_accept_terms(): def healthcareoie_account(): logger.debug("healthcareoie_account") return render_template( - "healthcare/account.html", + "healthcareoie/account.html", user_info=get_userinfo(), config=session[SESSION_INSTANCE_SETTINGS_KEY]) @@ -123,7 +123,7 @@ def healthcareoie_schedule(): gender = user["profile"][get_udp_ns_fieldname("gender")] return render_template( - "healthcare/schedule.html", + "healthcareoie/schedule.html", id_token=TokenUtil.get_id_token(request.cookies), access_token=TokenUtil.get_access_token(request.cookies), user_info=get_userinfo(), @@ -271,7 +271,7 @@ def healthcareoie_clear_consent(userid): def healthcareoie_healthrecord(): logger.debug("healthcareoie_healthrecord") return render_template( - "healthcare/healthrecord.html", + "healthcareoie/healthrecord.html", user_info=get_userinfo(), config=session[SESSION_INSTANCE_SETTINGS_KEY]) @@ -327,7 +327,7 @@ def healthcareoie_healthins(): claims.append(claimEntry) return render_template( - "healthcare/healthins.html", + "healthcareoie/healthins.html", user_info=get_userinfo(), patient_name=name, medication_info=medications, @@ -394,7 +394,7 @@ def _get_smart(request): smart_config = { 'app_id': session[SESSION_INSTANCE_SETTINGS_KEY]["settings"]["app_ins_fhir_clientid"], 'api_base': session[SESSION_INSTANCE_SETTINGS_KEY]["settings"]["app_ins_fhir_api_base"], - 'redirect_uri': request.url_root + "healthcare/smartfhir_callback", + 'redirect_uri': request.url_root + "healthcareoie/smartfhir_callback", 'scope': 'launch/patient patient/Patient.read patient/MedicationRequest.read patient/Claim.read skip_patient_selection' } sessionId = session.get('fhir_session_id')