api(auth): add auth endpoints (setup, login, logout, status), tests, and dependency token decoding; update docs
This commit is contained in:
@@ -17,6 +17,7 @@ except ImportError:
|
||||
|
||||
from src.config.settings import settings
|
||||
from src.core.SeriesApp import SeriesApp
|
||||
from src.server.services.auth_service import AuthError, auth_service
|
||||
|
||||
# Security scheme for JWT authentication
|
||||
security = HTTPBearer()
|
||||
@@ -93,12 +94,22 @@ def get_current_user(
|
||||
Raises:
|
||||
HTTPException: If token is invalid or user is not authenticated
|
||||
"""
|
||||
# TODO: Implement JWT token validation
|
||||
# This is a placeholder for authentication implementation
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_501_NOT_IMPLEMENTED,
|
||||
detail="Authentication functionality not yet implemented"
|
||||
)
|
||||
if not credentials:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail="Missing authorization credentials",
|
||||
)
|
||||
|
||||
token = credentials.credentials
|
||||
try:
|
||||
# Validate and decode token using the auth service
|
||||
session = auth_service.create_session_model(token)
|
||||
return session.dict()
|
||||
except AuthError as e:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail=str(e),
|
||||
)
|
||||
|
||||
|
||||
def require_auth(
|
||||
|
||||
Reference in New Issue
Block a user