Skip to content

Commit 9831998

Browse files
authored
Merge pull request #94 from datakind/Validation-Errors
feat: added option for api auth
2 parents aba20d2 + f3edcc5 commit 9831998

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/webapp/authn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def get_api_key(
5454

5555

5656
def check_creds(username: str, password: str) -> bool:
57-
return username == env_vars.get("USERNAME") and password == env_vars.get("PASSWORD")
57+
return username == env_vars["USERNAME"] and password == env_vars["PASSWORD"]
5858

5959

6060
def verify_password(plain_password: str, hashed_password: str) -> bool:

src/webapp/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ async def access_token_from_api_key(
105105

106106
user = authenticate_api_key(api_key_enduser_tuple, local_session.get())
107107
valid = check_creds(form_data.username, form_data.password)
108+
logger.info(f"api_key input: {api_key_enduser_tuple}")
109+
logger.info(f"user: {user}")
110+
logger.info(f"valid creds: {valid}")
108111

109112
if not user and not valid:
110113
raise HTTPException(

0 commit comments

Comments
 (0)