Commit e15dbdc4 authored by Tim Farrell's avatar Tim Farrell
Browse files

Pass the instance we're using.

parent 8c37edd0
...@@ -21,7 +21,7 @@ ALGORITHM = "HS256" ...@@ -21,7 +21,7 @@ ALGORITHM = "HS256"
# Auth Utils # Auth Utils
############## ##############
bearer_scheme = HTTPBearer() bearer_security = HTTPBearer()
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
...@@ -58,7 +58,7 @@ def extract_token_from_auth_header(auth_header: str): ...@@ -58,7 +58,7 @@ def extract_token_from_auth_header(auth_header: str):
return auth_header[len("Bearer ") :] return auth_header[len("Bearer ") :]
def get_current_user(auth_token: HTTPAuthorizationCredentials = Depends(HTTPBearer())): def get_current_user(auth_token: HTTPAuthorizationCredentials = Depends(bearer_security)):
data = decode_token(auth_token.credentials) data = decode_token(auth_token.credentials)
if data != None and "id" in data: if data != None and "id" in data:
user = Users.get_user_by_id(data["id"]) user = Users.get_user_by_id(data["id"])
......
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