From 93c2232ce19e00187334ee89a9bfcee79b77fce4 Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Thu, 21 Mar 2024 11:47:15 -0700 Subject: [PATCH] Read secret_list from actual file if present, else use sample file. Added a try-catch block similar to how other config files are used in case where actual non-sample file is present else use the sample file. Can remove the file from internal repo since not needed anymore. --- emission/net/auth/secret.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/emission/net/auth/secret.py b/emission/net/auth/secret.py index 1593fc2fb..582a15d5a 100644 --- a/emission/net/auth/secret.py +++ b/emission/net/auth/secret.py @@ -9,6 +9,15 @@ def __init__(self): key_file.close() self.client_secret_list = key_data["client_secret_list"] + try: + key_file = open('conf/net/auth/secret_list.json') + except: + print("secret_list.json not configured, falling back to sample, default configuration") + key_file = open('conf/net/auth/secret_list.json.sample') + key_data = json.load(key_file) + key_file.close() + self.client_secret_list = key_data["client_secret_list"] + def verifyUserToken(self, token): # attempt to validate token on the client-side logging.debug("Using the SecretAuthMethod to verify id token %s of length %d against secret list %s..." %