diff options
| author | stuppie | 2026-09-01 11:56:05 -0600 |
|---|---|---|
| committer | stuppie | 2026-09-01 11:56:05 -0600 |
| commit | c991d4f51254b1c81fa6e0e19b0ba94b8c5f61c4 (patch) | |
| tree | 34598a150db7c85b7e0ee50d1ced31bda74d271c /jb/api | |
| parent | 3f8d178d38686c1a5d71d94ebccdb61701469e95 (diff) | |
| download | amt-jb-c991d4f51254b1c81fa6e0e19b0ba94b8c5f61c4.tar.gz amt-jb-c991d4f51254b1c81fa6e0e19b0ba94b8c5f61c4.zip | |
add GRApiManager. py-utils to generalresearch
Diffstat (limited to 'jb/api')
| -rw-r--r-- | jb/api/auth.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/jb/api/auth.py b/jb/api/auth.py index 7d6c352..3481b30 100644 --- a/jb/api/auth.py +++ b/jb/api/auth.py @@ -8,13 +8,12 @@ from fastapi import Depends, HTTPException, Request, Response, status from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer from jb.config import settings -from jb.models.auth import AuthenticatedUser +from jb.decorators import gr_api_manager +from jb.models.auth import User bearer = HTTPBearer(auto_error=False) logger = logging.getLogger(__name__) -AUTH_CACHE_TTL_SECONDS = 60 - SESSION_COOKIE_NAME = "jb_session" JWT_ISSUER = "jamesbillings67" JWT_AUDIENCE = "jamesbillings67" @@ -23,7 +22,7 @@ JWT_AUDIENCE = "jamesbillings67" def get_authenticated_user( request: Request, credentials: Annotated[HTTPAuthorizationCredentials | None, Depends(bearer)], -) -> AuthenticatedUser: +) -> User: """FastAPI dependency for endpoints requiring a valid session.""" if settings.session_jwt_secret is None: raise HTTPException( @@ -66,11 +65,9 @@ def get_authenticated_user( ) product_user_id = claims.get("sub") - # todo: in here, hit THL by the user's bpuid (email hash), - # in order to 1) be sure user exists & 2) pull the display_name - user_email = ... # lookup in thl by product_user_id + user = gr_api_manager.get_user(product_user_id=product_user_id) - return AuthenticatedUser(email=user_email) + return user def create_session(product_user_id: str) -> str: |
