Application fully migrated to modular approach
This commit is contained in:
@@ -6,7 +6,8 @@ from models.database_models import User, Shop
|
||||
from middleware.auth import AuthManager
|
||||
from middleware.rate_limiter import RateLimiter
|
||||
|
||||
security = HTTPBearer()
|
||||
# Set auto_error=False to prevent automatic 403 responses
|
||||
security = HTTPBearer(auto_error=False)
|
||||
auth_manager = AuthManager()
|
||||
rate_limiter = RateLimiter()
|
||||
|
||||
@@ -16,6 +17,10 @@ def get_current_user(
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
"""Get current authenticated user"""
|
||||
# Check if credentials are provided
|
||||
if not credentials:
|
||||
raise HTTPException(status_code=401, detail="Authorization header required")
|
||||
|
||||
return auth_manager.get_current_user(db, credentials)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user