CAH plugin ------ initial work/to be refactored, working through implementation bits

This commit is contained in:
2024-09-19 20:58:33 -04:00
parent a4d9fa797c
commit f20a325a1f
3 changed files with 14 additions and 11 deletions

10
util.py
View File

@ -25,7 +25,7 @@ class Utilities:
Accepts path as an argument to allow fine tuning access for each API key, not currently in use.
"""
print(f"Testing with path: {path}, key: {key}")
# print(f"Testing with path: {path}, key: {key}")
if not key or not key.startswith("Bearer "):
return False
@ -33,20 +33,20 @@ class Utilities:
key = key.split("Bearer ", maxsplit=1)[1].strip()
if not key in self.constants.API_KEYS:
print("Auth failed")
# print("Auth failed")
return False
if req_type == 2:
if not key.startswith("PRV-"):
print("Auth failed - not a PRV key")
# print("Auth failed - not a PRV key")
return False
else:
return True
if path.lower().startswith("/xc/") and not key.startswith("XC-"):
print("Auth failed - not an XC Key")
# print("Auth failed - not an XC Key")
return False
print("Auth succeeded")
# print("Auth succeeded")
return True