+
    ûwÖiA  ã                   óZ   € R t ^ RIt^ RIHtHtHt ^ RIHtHt R R lt	R R lt
R R	 ltR# )
zKUtilities for OAuth 2.0 Resource Indicators (RFC 8707) and PKCE (RFC 7636).N)ÚurlparseÚurlsplitÚ
urlunsplit)ÚAnyUrlÚHttpUrlc                ó\   € V ^8„  d   QhR\         \        ,          \        ,          R\         /# )é   ÚurlÚreturn)Ústrr   r   )Úformats   "ÚI/home/ubuntu/.local/lib/python3.14/site-packages/mcp/shared/auth_utils.pyÚ__annotate__r   	   s#   € ÷ ñ ¤c¬G¥m´fÕ&<ð Äñ ó    c                óÌ   € \        V 4      p\        V4      p\        VP                  VP                  P                  4       VP                  P                  4       RR7      4      pV# )a(  Convert server URL to canonical resource URL per RFC 8707.

RFC 8707 section 2 states that resource URIs "MUST NOT include a fragment component".
Returns absolute URI with lowercase scheme/host for canonical form.

Args:
    url: Server URL to convert

Returns:
    Canonical resource URL string
Ú )ÚschemeÚnetlocÚfragment)r   r   r   Ú_replacer   Úlowerr   )r	   Úurl_strÚparsedÚ	canonicals   &   r   Úresource_url_from_server_urlr   	   sV   € ô #‹h€Gô gÓ€FÜ˜6Ÿ?™?°&·-±-×2EÑ2EÓ2GÐPV×P]ÑP]×PcÑPcÓPeÐpr˜?ÓsÓt€IàÐr   c                ó<   € V ^8„  d   QhR\         R\         R\        /# )r   Úrequested_resourceÚconfigured_resourcer
   )r   Úbool)r   s   "r   r   r      s"   € ÷ "6ñ "6¬sð "6Ìð "6ÔQUñ "6r   c                óà  € \        V 4      p\        V4      pVP                  P                  4       VP                  P                  4       8w  g8   VP                  P                  4       VP                  P                  4       8w  d   R# VP                  pVP                  pVP                  R4      '       g
   VR,          pVP                  R4      '       g
   VR,          pVP                  V4      # )aü  Check if a requested resource URL matches a configured resource URL.

A requested resource matches if it has the same scheme, domain, port,
and its path starts with the configured resource's path. This allows
hierarchical matching where a token for a parent resource can be used
for child resources.

Args:
    requested_resource: The resource URL being requested
    configured_resource: The resource URL that has been configured

Returns:
    True if the requested resource matches the configured resource
FÚ/)r   r   r   r   ÚpathÚendswithÚ
startswith)r   r   Ú	requestedÚ
configuredÚrequested_pathÚconfigured_paths   &&    r   Úcheck_resource_allowedr(      sÈ   € ô  Ð+Ó,€IÜÐ-Ó.€Jð ×Ñ×ÑÓ :×#4Ñ#4×#:Ñ#:Ó#<Ô<À	×@PÑ@P×@VÑ@VÓ@XÐ\f×\mÑ\m×\sÑ\sÓ\uÔ@uÙð —^‘^€NØ —o‘o€OØ×"Ñ" 3×'Ò'Ø˜#ÕˆØ×#Ñ# C×(Ò(Ø˜3Õˆð ×$Ñ$ _Ó5Ð5r   c                ób   € V ^8„  d   QhR\         \        ,          R,          R\        R,          /# )r   Ú
expires_inNr
   )Úintr   Úfloat)r   s   "r   r   r   D   s'   € ÷ )ñ )¤s¬S¥y°4Õ'7ð )¼EÀD½Lñ )r   c                óX   € V f   R# \         P                   ! 4       \        V 4      ,           # )zâCalculate token expiry timestamp from expires_in seconds.

Args:
    expires_in: Seconds until token expiration (may be string from some servers)

Returns:
    Unix timestamp when token expires, or None if no expiry specified
N)Útimer+   )r*   s   &r   Úcalculate_token_expiryr/   D   s"   € ð ÒÙä9Š9‹;œ˜Z›Õ(Ð(r   )Ú__doc__r.   Úurllib.parser   r   r   Úpydanticr   r   r   r(   r/   © r   r   Ú<module>r4      s$   ðÙ Qã ß 7Ñ 7ç $õõ,"6÷J)r   