Ë
    ÑÕ°j�'  ã                  ó¬   — d dl mZ d dlZd dlZd dlmZ d dlZddl	m
Z
 ddl	mZ ddl	mZ ddlmZ ej                  rd dlZ G d	„ d
«      Z G d„ d«      Zy)é    )ÚannotationsNé   )Údump_header)Úparse_dict_header)Úquote_header_valueé   )ÚCallbackDictc                  ó€   — e Zd ZdZ	 	 d	 	 	 	 	 	 	 dd„Zdd„Zdd„Zddd„Zdd„Zdd„Z	e
dd	„«       Zdd
„Zdd„Zdd„Zy)ÚAuthorizationa»  Represents the parts of an ``Authorization`` request header.

    :attr:`.Request.authorization` returns an instance if the header is set.

    An instance can be used with the test :class:`.Client` request methods' ``auth``
    parameter to send the header in test requests.

    Depending on the auth scheme, either :attr:`parameters` or :attr:`token` will be
    set. The ``Basic`` scheme's token is decoded into the ``username`` and ``password``
    parameters.

    For convenience, ``auth["key"]`` and ``auth.key`` both access the key in the
    :attr:`parameters` dict, along with ``auth.get("key")`` and ``"key" in auth``.

    .. versionchanged:: 2.3
        The ``token`` parameter and attribute was added to support auth schemes that use
        a token instead of parameters, such as ``Bearer``.

    .. versionchanged:: 2.3
        The object is no longer a ``dict``.

    .. versionchanged:: 0.5
        The object is an immutable dict.
    Nc                ó:   — || _         	 |€i }|| _        	 || _        y ©N)ÚtypeÚ
parametersÚtoken)ÚselfÚ	auth_typeÚdatar   s       úR/var/www/mission/venv/lib/python3.12/site-packages/werkzeug/datastructures/auth.pyÚ__init__zAuthorization.__init__+   s2   € ð ˆŒ	ØRàˆ<ØˆDàˆŒð	ð ˆŒ
ð	ó    c                ó8   — | j                   j                  |«      S r   ©r   Úget©r   Únames     r   Ú__getattr__zAuthorization.__getattr__C   ó   € Ø�‰×"Ñ" 4Ó(Ð(r   c                ó8   — | j                   j                  |«      S r   r   r   s     r   Ú__getitem__zAuthorization.__getitem__F   r   r   c                ó:   — | j                   j                  ||«      S r   r   ©r   ÚkeyÚdefaults      r   r   zAuthorization.getI   ó   € Ø�‰×"Ñ" 3¨Ó0Ð0r   c                ó   — || j                   v S r   ©r   ©r   r"   s     r   Ú__contains__zAuthorization.__contains__L   ó   € Ø�d—o‘oÐ%Ð%r   c                óÌ   — t        |t        «      st        S |j                  | j                  k(  xr4 |j                  | j                  k(  xr |j
                  | j
                  k(  S r   )Ú
isinstancer   ÚNotImplementedr   r   r   ©r   Úothers     r   Ú__eq__zAuthorization.__eq__O   sU   € Ü˜%¤Ô/Ü!Ð!ð �J‰J˜$Ÿ)™)Ñ#ò 4Ø—‘˜tŸz™zÑ)ò4à× Ñ  D§O¡OÑ3ð	
r   c                ó   — |sy|j                  d«      \  }}}|j                  «       }|j                  «       }|dk(  rC	 t        j                  |«      j                  «       j                  d«      \  }}} | |||dœ«      S d|j                  d«      v r | |t        |«      d«      S  | |d|«      S # t        j                  t        f$ r Y yw xY w)zÄParse an ``Authorization`` header value and return an instance, or ``None``
        if the value is empty.

        :param value: The header value to parse.

        .. versionadded:: 2.3
        Nú Úbasicú:)ÚusernameÚpasswordú=)Ú	partitionÚlowerÚstripÚbase64Ú	b64decodeÚdecodeÚbinasciiÚErrorÚUnicodeErrorÚrstripr   )ÚclsÚvalueÚschemeÚ_Úrestr4   r5   s          r   Úfrom_headerzAuthorization.from_headerY   sÕ   € ñ ØàŸ/™/¨#Ó.‰ˆ��4Ø—‘“ˆØ�z‰z‹|ˆà�WÒðÜ(.×(8Ñ(8¸Ó(>×(EÑ(EÓ(G×(QÑ(QÐRUÓ(VÑ%�˜!˜Xñ �v¨HÀ(ÑKÓLÐLà�$—+‘+˜cÓ"Ñ"á�vÔ0°Ó6¸Ó=Ð=ñ �6˜4 Ó&Ð&øô —N‘N¤LÐ1ò Ùðús   ¿6B1 Â1CÃCc                óŽ  — | j                   dk(  rPt        j                  | j                  › d| j                  › �j                  «       «      j                  d«      }d|› �S | j                  �)| j                   j                  «       › d| j                  › �S | j                   j                  «       › dt        | j                  «      › �S )ziProduce an ``Authorization`` header value representing this data.

        .. versionadded:: 2.0
        r2   r3   ÚasciizBasic r1   )r   r:   Ú	b64encoder4   r5   Úencoder<   r   Útitler   r   ©r   rB   s     r   Ú	to_headerzAuthorization.to_headerx   s¬   € ð
 �9‰9˜ÒÜ×$Ñ$Ø—=‘=�/  4§=¡= /Ð2×9Ñ9Ó;óç‰f�W‹oð ð ˜E˜7Ð#Ð#à�:‰:Ð!Ø—i‘i—o‘oÓ'Ð(¨¨$¯*©*¨Ð6Ð6à—)‘)—/‘/Ó#Ð$ A¤k°$·/±/Ó&BÐ%CÐDÐDr   c                ó"   — | j                  «       S r   ©rM   ©r   s    r   Ú__str__zAuthorization.__str__ˆ   ó   € Ø�~‰~ÓÐr   c                óV   — dt        | «      j                  › d| j                  «       › d�S ©Nú<r1   ú>©r   Ú__name__rM   rP   s    r   Ú__repr__zAuthorization.__repr__‹   ó*   € Ø”4˜“:×&Ñ&Ð' q¨¯©Ó)9Ð(:¸!Ð<Ð<r   ©NN)r   Ústrr   údict[str, str | None] | Noner   ú
str | NoneÚreturnÚNone©r   r\   r_   r^   r   ©r"   r\   r#   r^   r_   r^   ©r"   r\   r_   Úbool©r.   Úobjectr_   rd   ©rB   r^   r_   zte.Self | None©r_   r\   )rX   Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r(   r/   ÚclassmethodrF   rM   rQ   rY   © r   r   r   r      sw   „ ñð8 .2Ø ð	àðð +ðð ð	ð
 
óó0)ó)ô1ó&ó
ð ò'ó ð'ó<Eó  ô=r   r   c                  óX  ‡ — e Zd ZdZ	 	 d	 	 	 	 	 dd„Zdd„Zedd„«       Zej                  dd„«       Zedd„«       Z	e	j                  dd„«       Z	edd„«       Z
e
j                  dd	„«       Z
d d
„Zd!d„Zd"d„Zd#d„Zd$ˆ fd„Zd%d„Zd&d„Zd'd„Zd(d)d„Zed*d„«       Zdd„Zdd„Zdd„Zˆ xZS )+ÚWWWAuthenticateaÜ  Represents the parts of a ``WWW-Authenticate`` response header.

    Set :attr:`.Response.www_authenticate` to an instance of list of instances to set
    values for this header in the response. Modifying this instance will modify the
    header value.

    Depending on the auth scheme, either :attr:`parameters` or :attr:`token` should be
    set. The ``Basic`` scheme will encode ``username`` and ``password`` parameters to a
    token.

    For convenience, ``auth["key"]`` and ``auth.key`` both act on the :attr:`parameters`
    dict, and can be used to get, set, or delete parameters. ``auth.get("key")`` and
    ``"key" in auth`` are also provided.

    .. versionchanged:: 2.3
        The ``token`` parameter and attribute was added to support auth schemes that use
        a token instead of parameters, such as ``Bearer``.

    .. versionchanged:: 2.3
        The object is no longer a ``dict``.

    .. versionchanged:: 2.3
        The ``on_update`` parameter was removed.
    c                ót   ‡ — |j                  «       ‰ _        t        |ˆ fd„«      ‰ _        |‰ _        d ‰ _        y )Nc                ó$   •— ‰j                  «       S r   ©Ú_trigger_on_update©rD   r   s    €r   ú<lambda>z*WWWAuthenticate.__init__.<locals>.<lambda>±   s   ø€ ˜d×5Ñ5Ó7€ r   )r8   Ú_typer	   Ú_parametersÚ_tokenÚ
_on_update)r   r   Úvaluesr   s   `   r   r   zWWWAuthenticate.__init__©   s6   ø€ ð —_‘_Ó&ˆŒ
Ü2>ØÓ7ó3
ˆÔð ˆŒØIMˆ�r   c                ó@   — | j                   �| j                  | «       y y r   )ry   rP   s    r   rs   z"WWWAuthenticate._trigger_on_update¶   s   € Ø�?‰?Ð&Ø�O‰O˜DÕ!ð 'r   c                ó   — | j                   S )zDThe authorization scheme, like ``basic``, ``digest``, or ``bearer``.)rv   rP   s    r   r   zWWWAuthenticate.typeº   s   € ð �z‰zÐr   c                ó2   — || _         | j                  «        y r   )rv   rs   rL   s     r   r   zWWWAuthenticate.type¿   s   € àˆŒ
Ø×ÑÕ!r   c                ó   — | j                   S ©zA dict of parameters for the header. Only one of this or :attr:`token` should
        have a value for a given scheme.
        )rw   rP   s    r   r   zWWWAuthenticate.parametersÄ   s   € ð
 ×ÑÐr   c                óN   ‡ — t        |ˆ fd„«      ‰ _        ‰ j                  «        y )Nc                ó$   •— ‰j                  «       S r   rr   rt   s    €r   ru   z,WWWAuthenticate.parameters.<locals>.<lambda>Í   s   ø€ ¸×9PÑ9PÓ9R€ r   )r	   rw   rs   rL   s   ` r   r   zWWWAuthenticate.parametersË   s   ø€ ä'¨Ó/RÓSˆÔØ×ÑÕ!r   c                ó   — | j                   S r   )rx   rP   s    r   r   zWWWAuthenticate.tokenÐ   s   € ð
 �{‰{Ðr   c                ó2   — || _         | j                  «        y)z–A token for the header. Only one of this or :attr:`parameters` should have a
        value for a given scheme.

        .. versionadded:: 2.3
        N)rx   rs   rL   s     r   r   zWWWAuthenticate.token×   s   € ð ˆŒØ×ÑÕ!r   c                ó8   — | j                   j                  |«      S r   r   r'   s     r   r   zWWWAuthenticate.__getitem__á   s   € Ø�‰×"Ñ" 3Ó'Ð'r   c                ó~   — |€|| j                   v r| j                   |= n|| j                   |<   | j                  «        y r   ©r   rs   )r   r"   rB   s      r   Ú__setitem__zWWWAuthenticate.__setitem__ä   s9   € Øˆ=Ø�d—o‘oÑ%Ø—O‘O CÑ(à#(ˆD�O‰O˜CÑ à×ÑÕ!r   c                ó\   — || j                   v r| j                   |= | j                  «        y y r   r†   r'   s     r   Ú__delitem__zWWWAuthenticate.__delitem__í   s+   € Ø�$—/‘/Ñ!Ø—‘ Ð$Ø×#Ñ#Õ%ð "r   c                ó   — | |   S r   rm   r   s     r   r   zWWWAuthenticate.__getattr__ò   s   € Ø�D‰zÐr   c                ó:   •— |dv rt         ‰| �  ||«       y || |<   y )N>   rv   rx   ry   rw   )ÚsuperÚ__setattr__)r   r   rB   Ú	__class__s      €r   r�   zWWWAuthenticate.__setattr__õ   s$   ø€ ØÐCÑCÜ‰GÑ  eÕ,àˆD�ŠJr   c                ó
   — | |= y r   rm   r   s     r   Ú__delattr__zWWWAuthenticate.__delattr__û   s	   € Ø�‰Jr   c                ó   — || j                   v S r   r&   r'   s     r   r(   zWWWAuthenticate.__contains__þ   r)   r   c                óÌ   — t        |t        «      st        S |j                  | j                  k(  xr4 |j                  | j                  k(  xr |j
                  | j
                  k(  S r   )r+   ro   r,   r   r   r   r-   s     r   r/   zWWWAuthenticate.__eq__  sU   € Ü˜%¤Ô1Ü!Ð!ð �J‰J˜$Ÿ)™)Ñ#ò 4Ø—‘˜tŸz™zÑ)ò4à× Ñ  D§O¡OÑ3ð	
r   c                ó:   — | j                   j                  ||«      S r   r   r!   s      r   r   zWWWAuthenticate.get  r$   r   c                óÒ   — |sy|j                  d«      \  }}}|j                  «       }|j                  «       }d|j                  d«      v r | |t	        |«      d«      S  | |d|«      S )zÆParse a ``WWW-Authenticate`` header value and return an instance, or ``None``
        if the value is empty.

        :param value: The header value to parse.

        .. versionadded:: 2.3
        Nr1   r6   )r7   r8   r9   r@   r   )rA   rB   rC   rD   rE   s        r   rF   zWWWAuthenticate.from_header  sk   € ñ ØàŸ/™/¨#Ó.‰ˆ��4Ø—‘“ˆØ�z‰z‹|ˆà�$—+‘+˜cÓ"Ñ"á�vÔ0°Ó6¸Ó=Ð=ñ �6˜4 Ó&Ð&r   c                ó  — | j                   �)| j                  j                  «       › d| j                   › �S | j                  s| j                  j                  «       S | j                  dk(  rkg }| j                  j	                  «       D ]8  \  }}|dv rt        |d¬«      }nt        |«      }|j                  |› d|› �«       Œ: ddj                  |«      › �S | j                  j                  «       › dt        | j                  «      › �S )	zCProduce a ``WWW-Authenticate`` header value representing this data.r1   Údigest>   ÚqopÚnonceÚrealmÚdomainÚopaqueF)Úallow_tokenr6   zDigest z, )	r   r   rK   r   Úitemsr   ÚappendÚjoinr   )r   r�   r"   rB   s       r   rM   zWWWAuthenticate.to_header%  sì   € à�:‰:Ð!Ø—i‘i—o‘oÓ'Ð(¨¨$¯*©*¨Ð6Ð6à�ŠØ—9‘9—?‘?Ó$Ð$à�9‰9˜Ò ØˆEà"Ÿo™o×3Ñ3Ó5ò /‘
��UØÐGÑGÜ.¨uÀ%ÔH‘Eä.¨uÓ5�Eà—‘ ˜u A e WÐ-Õ.ð/ð ˜TŸY™Y uÓ-Ð.Ð/Ð/à—)‘)—/‘/Ó#Ð$ A¤k°$·/±/Ó&BÐ%CÐDÐDr   c                ó"   — | j                  «       S r   rO   rP   s    r   rQ   zWWWAuthenticate.__str__<  rR   r   c                óV   — dt        | «      j                  › d| j                  «       › d�S rT   rW   rP   s    r   rY   zWWWAuthenticate.__repr__?  rZ   r   r[   )r   r\   rz   r]   r   r^   )r_   r`   rh   )rB   r\   r_   r`   )r_   zdict[str, str | None])rB   zdict[str, str]r_   r`   )r_   r^   )rB   r^   r_   r`   )r"   r\   r_   r^   )r"   r\   rB   r^   r_   r`   )r"   r\   r_   r`   ra   )r   r\   rB   r^   r_   r`   )r   r\   r_   r`   rc   re   r   rb   rg   )rX   ri   rj   rk   r   rs   Úpropertyr   Úsetterr   r   r   r‡   r‰   r   r�   r�   r(   r/   r   rl   rF   rM   rQ   rY   Ú__classcell__)rŽ   s   @r   ro   ro   �   s  ø„ ñð8 04Ø ð	NàðNð -ðNð ó	Nó"ð òó ðð 
‡[�[ò"ó ð"ð ò ó ð ð ×Ñò"ó ð"ð òó ðð ‡\�\ò"ó ð"ó(ó"ó&ó
õóó&ó
ô1ð ò'ó ð'ó,Eó. ÷=r   ro   )Ú
__future__r   r:   r=   Úcollections.abcÚabcÚcabcÚtypingÚtÚhttpr   r   r   Ú
structuresr	   ÚTYPE_CHECKINGÚtyping_extensionsÚter   ro   rm   r   r   ú<module>r°      sC   ðÝ "ã Û Ý Û å Ý $Ý %Ý $à‡?‚?Û"÷{=ñ {=÷|q=ò q=r   