§
    öŽ’jÐ  ã                   ó    — d dl Z d dlmZmZmZmZ d dlmZ d dlm	Z	  e j
        edz           dd¬¦  «        Zde	dz  fd„Z G d	„ d
¦  «        ZdS )é    N)ÚASGIAppÚReceiveÚScopeÚSend)ÚAuthenticatedUser)ÚAccessTokenÚauth_context)ÚdefaultÚreturnc                  óJ   — t                                ¦   «         } | r| j        ndS )z–
    Get the access token from the current context.

    Returns:
        The access token if an authenticated user is available, None otherwise.
    N)Úauth_context_varÚgetÚaccess_token)Ú	auth_users    úUC:\Projects\DSCons\.venv\Lib\site-packages\mcp\server\auth\middleware\auth_context.pyÚget_access_tokenr      s(   € õ !×$Ò$Ñ&Ô&€IØ%.Ð8ˆ9Ô!Ð!°DÐ8ó    c                   ó2   — e Zd ZdZdefd„Zdededefd„Z	dS )	ÚAuthContextMiddlewareaZ  
    Middleware that extracts the authenticated user from the request
    and sets it in a contextvar for easy access throughout the request lifecycle.

    This middleware should be added after the AuthenticationMiddleware in the
    middleware stack to ensure that the user is properly authenticated before
    being stored in the context.
    Úappc                 ó   — || _         d S )N)r   )Úselfr   s     r   Ú__init__zAuthContextMiddleware.__init__"   s   € ØˆŒˆˆr   ÚscopeÚreceiveÚsendc              ƒ   ó~  K  — |                      d¦  «        }t          |t          ¦  «        rst                               |¦  «        }	 |                      |||¦  «        ƒ d {V —† t                               |¦  «         d S # t                               |¦  «         w xY w|                      |||¦  «        ƒ d {V —† d S )NÚuser)r   Ú
isinstancer   r   Úsetr   Úreset)r   r   r   r   r   Útokens         r   Ú__call__zAuthContextMiddleware.__call__%   sÏ   è è € Ø�yŠy˜Ñ Ô ˆÝ�dÕ-Ñ.Ô.ð 		1å$×(Ò(¨Ñ.Ô.ˆEð.Ø—h’h˜u g¨tÑ4Ô4Ð4Ð4Ð4Ð4Ð4Ð4Ð4å ×&Ò& uÑ-Ô-Ð-Ð-Ð-øÕ ×&Ò& uÑ-Ô-Ð-Ð-øøøð —(’(˜5 '¨4Ñ0Ô0Ð0Ð0Ð0Ð0Ð0Ð0Ð0Ð0Ð0s   ÁB ÂBN)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r#   © r   r   r   r      sb   € € € € € ðð ð˜Gð ð ð ð ð1 Eð 1°Gð 1À4ð 1ð 1ð 1ð 1ð 1ð 1r   r   )ÚcontextvarsÚstarlette.typesr   r   r   r   Ú&mcp.server.auth.middleware.bearer_authr   Úmcp.server.auth.providerr   Ú
ContextVarr   r   r   r(   r   r   ú<module>r.      sÒ   ðØ Ð Ð Ð à 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9à DÐ DÐ DÐ DÐ DÐ DØ 0Ð 0Ð 0Ð 0Ð 0Ð 0ð D�;Ô)Ð*;¸dÑ*BÔCÀNÐ\`ÐaÑaÔaÐ ð9˜+¨Ñ,ð 9ð 9ð 9ð 9ð1ð 1ð 1ð 1ð 1ñ 1ô 1ð 1ð 1ð 1r   