Skip to content

Commit

Permalink
Added additonal exception handling for invalid token signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
DCMattyG committed Dec 22, 2023
1 parent 1eca37e commit cb52117
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions engine/app/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ async def validate_token(request: Request):
raise HTTPException(status_code=401, detail="Token has expired.")
except jwt.MissingRequiredClaimError:
raise HTTPException(status_code=401, detail="Incorrect token claims, please check the audience and issuer.")
except jwt.InvalidSignatureError:
raise HTTPException(status_code=401, detail="Invalid token signature.")
except Exception:
raise HTTPException(status_code=401, detail="Unable to parse authorization token.")
else:
Expand Down

0 comments on commit cb52117

Please sign in to comment.