CAH plugin ------ initial work/to be refactored, working through implementation bits
This commit is contained in:
10
util.py
10
util.py
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user