"test/config_test/git@developer.sourcefind.cn:OpenDAS/nni.git" did not exist on "5ee549db00d6edec7af6726ffe9f05f3b2449e51"
Commit b11af9ea authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

fix

parent 56369fea
...@@ -48,9 +48,11 @@ class Token(BaseModel): ...@@ -48,9 +48,11 @@ class Token(BaseModel):
token: str token: str
token_type: str token_type: str
class ApiKey(BaseModel): class ApiKey(BaseModel):
api_key: Optional[str] = None api_key: Optional[str] = None
class UserResponse(BaseModel): class UserResponse(BaseModel):
id: str id: str
email: str email: str
...@@ -132,6 +134,7 @@ class AuthsTable: ...@@ -132,6 +134,7 @@ class AuthsTable:
# if no api_key, return None # if no api_key, return None
if not api_key: if not api_key:
return None return None
try: try:
auth = Auth.get(Auth.api_key == api_key, Auth.active == True) auth = Auth.get(Auth.api_key == api_key, Auth.active == True)
if auth: if auth:
...@@ -140,6 +143,9 @@ class AuthsTable: ...@@ -140,6 +143,9 @@ class AuthsTable:
else: else:
return None return None
except:
return False
def authenticate_user_by_trusted_header(self, email: str) -> Optional[UserModel]: def authenticate_user_by_trusted_header(self, email: str) -> Optional[UserModel]:
log.info(f"authenticate_user_by_trusted_header: {email}") log.info(f"authenticate_user_by_trusted_header: {email}")
try: try:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment