Team Ai
Apppublic

ruby2210/todo-manager

sourceHugging Facemitupdated 9mo agoView on Hugging Face
0likes
deps.cpython-312.pyc29 linesDownload Raw Back to __pycache__
1�

2Wii>���ddlmZmZmZddlmZmZddlmZddl	m3Z4ddlmZddl
mZe�Zee�ee�fdeded	efd5�Zee�fded	eefd�Zy)
�)�Depends�
HTTPException�status)�6HTTPBearer�HTTPAuthorizationCredentials)�Optional)�get_current_user_id)�get_async_session)�AsyncSession�credentials�db�returnc��|K�|j}t|�}|sttjdddi���|S�w)ab7    Get current authenticated user ID from JWT token.8 9    Args:10        credentials: HTTP Authorization credentials containing JWT token11        db: Database session (included for potential future user lookup)12 13    Returns:14        User ID if authentication successful15 16    Raises:17        HTTPException: If authentication fails (401 Unauthorized)18    zCould not validate credentialszWWW-Authenticate�Bearer)�status_code�detail�headers)rr	rr�HTTP_401_UNAUTHORIZED)rr
�token�user_ids    �CC:\Users\Dell\OneDrive\Desktop\todo-manager\backend\src\api\deps.py�get_current_userrsH����"
�#�#�E�!�%�(�G����4�4�3�'��2�19�	20��N�s�:<c��8K�|j}t|�S�w)z�21    Get current authenticated user ID from JWT token (optional).22 23    Args:24        credentials: HTTP Authorization credentials containing JWT token25 26    Returns:27        User ID if authentication successful, None if invalid28    )rr	)rrs  r�get_optional_current_userr*s����
�#�#�E��u�%�%�s�N)�fastapirrr�fastapi.securityrr�typingr�src.auth.utilsr	�src.database.sessionr29�sqlalchemy.ext.asyncior�security�strrr��r�<module>r%sx��2�2�E��.�2�/��<��18��0A��0�1��-����	��>18��0A�
&�-�
&�
�c�]�
&r$