Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace python-jose with pyjwt #2925

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bytes/bytes/auth.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import logging
from datetime import datetime, timedelta, timezone

import jwt
from fastapi import Depends, HTTPException
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
from jose import JWTError, jwt
from jwt import InvalidTokenError
from passlib.context import CryptContext
from pydantic import BaseModel
from starlette import status
Expand Down Expand Up @@ -56,7 +57,7 @@ def authenticate_token(token: str = Depends(oauth2_scheme)) -> str:
raise credentials_exception

return str(username)
except JWTError as error:
except InvalidTokenError as error:
raise credentials_exception from error


Expand Down
75 changes: 19 additions & 56 deletions bytes/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bytes/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ prometheus-client = "^0.16.0"
psycopg2 = "^2.9.6"
pydantic = "^2.7.1"
pynacl = "^1.5.0"
python-jose = { version = "^3.3.0", extras = ["cryptography"] }
rfc3161ng = "^2.1.3"
sqlalchemy = "^1.4.48"
uvicorn = "^0.26.0"
Expand All @@ -38,6 +37,7 @@ opentelemetry-instrumentation-asgi = "^0.45b0"
opentelemetry-proto = "^1.24.0"
opentelemetry-semantic-conventions = "^0.45b0"
opentelemetry-util-http = "^0.45b0"
pyjwt = "^2.8.0"

[tool.poetry.group.dev.dependencies]
pytest = "^8.2.0"
Expand Down
12 changes: 3 additions & 9 deletions bytes/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,6 @@ cryptography==42.0.5 ; python_version >= "3.10" and python_version < "4.0" \
deprecated==1.2.14 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:6fac8b097794a90302bdbb17b9b815e732d3c4720583ff1b198499d78470466c \
--hash=sha256:e5323eb936458dccc2582dc6f9c322c852a775a27065ff2b0c4970b9d53d01b3
ecdsa==0.18.0 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:190348041559e21b22a1d65cee485282ca11a6f81d503fddb84d5017e9ed1e49 \
--hash=sha256:80600258e7ed2f16b9aa1d7c295bd70194109ad5a30fdee0eaeefef1d4c559dd
exceptiongroup==1.2.0 ; python_version >= "3.10" and python_version < "3.11" \
--hash=sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14 \
--hash=sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68
Expand Down Expand Up @@ -613,6 +610,9 @@ pydantic-settings==2.2.1 ; python_version >= "3.10" and python_version < "4.0" \
pydantic==2.7.1 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:e029badca45266732a9a79898a15ae2e8b14840b1eabbb25844be28f0b33f3d5 \
--hash=sha256:e9dbb5eada8abe4d9ae5f46b9939aead650cd2b68f249bb3a8139dbe125803cc
pyjwt==2.8.0 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:57e28d156e3d5c10088e0c68abb90bfac3df82b40a71bd0daa20c65ccd5c23de \
--hash=sha256:59127c392cc44c2da5bb3192169a91f429924e17aff6534d70fdc02ab3e04320
pynacl==1.5.0 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:06b8f6fa7f5de8d5d2f7573fe8c863c051225a27b61e6860fd047b1775807858 \
--hash=sha256:0c84947a22519e013607c9be43706dd42513f9e6ae5d39d3613ca1e142fba44d \
Expand All @@ -636,9 +636,6 @@ python-dateutil==2.9.0 ; python_version >= "3.10" and python_version < "4.0" \
python-dotenv==1.0.1 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca \
--hash=sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a
python-jose[cryptography]==3.3.0 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:55779b5e6ad599c6336191246e95eb2293a9ddebd555f796a65f838f07e5d78a \
--hash=sha256:9b1376b023f8b298536eedd47ae1089bcdb848f1535ab30555cd92002d78923a
python-multipart==0.0.9 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:03f54688c663f1b7977105f021043b0793151e4cb1c1a9d4a11fc13d622c4026 \
--hash=sha256:97ca7b8ea7b05f977dc3849c3ba99d51689822fab725c3703af7c866a0c2b215
Expand All @@ -648,9 +645,6 @@ requests==2.31.0 ; python_version >= "3.10" and python_version < "4.0" \
rfc3161ng==2.1.3 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:1e88614da61b22abd591577f9dd39d3a030335f9e8a12d8bc001149c17d0a01e \
--hash=sha256:81fe7e4488f523c758b1206bf5e72ba2066b78f2812107b1b7bb16a7596e524b
rsa==4.9 ; python_version >= "3.10" and python_version < "4" \
--hash=sha256:90260d9058e514786967344d0ef75fa8727eed8a7d2e43ce9f4bcf1b536174f7 \
--hash=sha256:e38464a49c6c85d7f1351b0126661487a7e0a14a50f1675ec50eb34d4f20ef21
setuptools==69.1.1 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:02fa291a0471b3a18b2b2481ed902af520c69e8ae0919c13da936542754b4c56 \
--hash=sha256:5c0806c7d9af348e6dd3777b4f4dbb42c7ad85b190104837488eab9a7c945cf8
Expand Down
12 changes: 3 additions & 9 deletions bytes/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,6 @@ cryptography==42.0.5 ; python_version >= "3.10" and python_version < "4.0" \
deprecated==1.2.14 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:6fac8b097794a90302bdbb17b9b815e732d3c4720583ff1b198499d78470466c \
--hash=sha256:e5323eb936458dccc2582dc6f9c322c852a775a27065ff2b0c4970b9d53d01b3
ecdsa==0.18.0 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:190348041559e21b22a1d65cee485282ca11a6f81d503fddb84d5017e9ed1e49 \
--hash=sha256:80600258e7ed2f16b9aa1d7c295bd70194109ad5a30fdee0eaeefef1d4c559dd
exceptiongroup==1.2.0 ; python_version >= "3.10" and python_version < "3.11" \
--hash=sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14 \
--hash=sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68
Expand Down Expand Up @@ -604,6 +601,9 @@ pydantic-settings==2.2.1 ; python_version >= "3.10" and python_version < "4.0" \
pydantic==2.7.1 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:e029badca45266732a9a79898a15ae2e8b14840b1eabbb25844be28f0b33f3d5 \
--hash=sha256:e9dbb5eada8abe4d9ae5f46b9939aead650cd2b68f249bb3a8139dbe125803cc
pyjwt==2.8.0 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:57e28d156e3d5c10088e0c68abb90bfac3df82b40a71bd0daa20c65ccd5c23de \
--hash=sha256:59127c392cc44c2da5bb3192169a91f429924e17aff6534d70fdc02ab3e04320
pynacl==1.5.0 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:06b8f6fa7f5de8d5d2f7573fe8c863c051225a27b61e6860fd047b1775807858 \
--hash=sha256:0c84947a22519e013607c9be43706dd42513f9e6ae5d39d3613ca1e142fba44d \
Expand All @@ -621,9 +621,6 @@ python-dateutil==2.9.0 ; python_version >= "3.10" and python_version < "4.0" \
python-dotenv==1.0.1 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca \
--hash=sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a
python-jose[cryptography]==3.3.0 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:55779b5e6ad599c6336191246e95eb2293a9ddebd555f796a65f838f07e5d78a \
--hash=sha256:9b1376b023f8b298536eedd47ae1089bcdb848f1535ab30555cd92002d78923a
python-multipart==0.0.9 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:03f54688c663f1b7977105f021043b0793151e4cb1c1a9d4a11fc13d622c4026 \
--hash=sha256:97ca7b8ea7b05f977dc3849c3ba99d51689822fab725c3703af7c866a0c2b215
Expand All @@ -633,9 +630,6 @@ requests==2.31.0 ; python_version >= "3.10" and python_version < "4.0" \
rfc3161ng==2.1.3 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:1e88614da61b22abd591577f9dd39d3a030335f9e8a12d8bc001149c17d0a01e \
--hash=sha256:81fe7e4488f523c758b1206bf5e72ba2066b78f2812107b1b7bb16a7596e524b
rsa==4.9 ; python_version >= "3.10" and python_version < "4" \
--hash=sha256:90260d9058e514786967344d0ef75fa8727eed8a7d2e43ce9f4bcf1b536174f7 \
--hash=sha256:e38464a49c6c85d7f1351b0126661487a7e0a14a50f1675ec50eb34d4f20ef21
setuptools==69.1.1 ; python_version >= "3.10" and python_version < "4.0" \
--hash=sha256:02fa291a0471b3a18b2b2481ed902af520c69e8ae0919c13da936542754b4c56 \
--hash=sha256:5c0806c7d9af348e6dd3777b4f4dbb42c7ad85b190104837488eab9a7c945cf8
Expand Down