From fb182832ed193f1e833452b00d8af955a08dd11f Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Thu, 4 Jan 2024 01:29:43 +0530 Subject: [PATCH] modify login response to enable codegen to generate header based client --- src/apis/authentication_api.py | 13 ++++++++++++- src/security_api.py | 6 +----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/apis/authentication_api.py b/src/apis/authentication_api.py index 0254be4..04e33b2 100755 --- a/src/apis/authentication_api.py +++ b/src/apis/authentication_api.py @@ -35,7 +35,18 @@ @router.post( "/auth/login", responses={ - 200: {"description": "Success"}, + 200: { + "description": "Success", + "headers": { + "X-Auth-Token": { + "schema":{ + "type": "string" + }, + "description": "header containing the auth token" + } + }, + "content": None + }, 401: {"description": "Unauthorized"}, }, tags=["Authentication"], diff --git a/src/security_api.py b/src/security_api.py index da0e52c..dad3f28 100755 --- a/src/security_api.py +++ b/src/security_api.py @@ -43,8 +43,4 @@ def get_password_hash(password: string): return hashed_password def verify_password_hash(password: string, password_hash: string): - try: - pwd_context.verify(password, password_hash) - except UnknownHashError as e: - return False - return True \ No newline at end of file + return pwd_context.verify(password, password_hash) \ No newline at end of file