jupyterhub_ai_gateway.security module#
Security module.
- async jupyterhub_ai_gateway.security.get_current_user(security_scopes: SecurityScopes, request: Request, token_parameter: str = Depends(APIKeyQuery), authorization_header: str = Depends(OAuth2AuthorizationCodeBearer)) User#
Retrieve the current user based on the provided token parameter or authorization header.
- Parameters:
security_scopes (SecurityScopes) – Scopes required for accessing the resource.
request (Request) – The incoming request object.
token_parameter (str) – Token provided as a query parameter.
authorization_header (str) – Token provided in the authorization header.
- Returns:
User object representing the authenticated user.
- Return type:
- Raises:
HTTPException – If authentication fails due to missing or invalid token, or if user is not authorized based on access scopes.