Skip to content

Commit

Permalink
Read secret_list from actual file if present, else use sample file.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Mahadik, Mukul Chandrakant authored and Mahadik, Mukul Chandrakant committed Mar 21, 2024
1 parent 174bfb1 commit 93c2232
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions emission/net/auth/secret.py
Original file line number Diff line number Diff line change
Expand Up @@ -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..." %
Expand Down

0 comments on commit 93c2232

Please sign in to comment.