Major dependency upgrades: Python 3.14, FastAPI, SQLAlchemy 2.1, PyJWT, MySQL 8.4
- Python base image 3.12-slim -> 3.14-slim - fastapi 0.136.3 -> 0.162.0, sqlalchemy 2.0.50 -> 2.1.6 - Replace unmaintained python-jose with PyJWT 2.15.1; tokens issued by python-jose remain valid, so existing sessions are not logged out - MySQL 8.0.46 (EOL) -> 8.4.13 LTS; in-place data dictionary upgrade runs automatically on first start Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
8f32a395a1
commit
2382289484
5 files changed
+10
-9
No files matched your search
+4
-3
@@ -3,7 +3,8 @@ from datetime import datetime, timedelta, timezone
|
||||
from typing import Optional
|
||||
|
||||
import bcrypt
|
||||
from jose import JWTError, jwt
|
||||
import jwt
|
||||
from jwt import InvalidTokenError
|
||||
from fastapi import Cookie, Depends, HTTPException, Response, status
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
@@ -82,7 +83,7 @@ async def get_current_user(
|
||||
if user_id_str is None:
|
||||
raise credentials_exception
|
||||
user_id = int(user_id_str)
|
||||
except (JWTError, ValueError):
|
||||
except (InvalidTokenError, ValueError):
|
||||
raise credentials_exception
|
||||
|
||||
user = db.get(User, user_id)
|
||||
@@ -110,7 +111,7 @@ async def get_token_payload(
|
||||
)
|
||||
try:
|
||||
return jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
|
||||
except JWTError:
|
||||
except InvalidTokenError:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail="Could not validate credentials",
|
||||
|
||||
Reference in new issue
Block a user