
    %hG'                        S SK Jr  S SKrS SKrS SKJr  S SKrSSK	J
r
  SSK	Jr  SSK	Jr  SSKJr  \R                  (       a  S SKr " S	 S
5      r " S S5      rg)    )annotationsN   )dump_header)parse_dict_header)quote_header_value   )CallbackDictc                      \ rS rSrSr  S       SS jjrSS jrSS jrSSS jjrSS jr	SS	 jr
\SS
 j5       rSS jrSS jrSS jrSrg)Authorization   a{  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                6    Xl          Uc  0 nX l         X0l        g N)type
parameterstoken)self	auth_typedatar   s       T/var/www/auris/envauris/lib/python3.13/site-packages/werkzeug/datastructures/auth.py__init__Authorization.__init__+   s,     	R<D	 
	    c                8    U R                   R                  U5      $ r   r   getr   names     r   __getattr__Authorization.__getattr__C       ""4((r   c                8    U R                   R                  U5      $ r   r   r   s     r   __getitem__Authorization.__getitem__F   r    r   c                8    U R                   R                  X5      $ r   r   r   keydefaults      r   r   Authorization.getI       ""300r   c                    XR                   ;   $ r   r   r   r&   s     r   __contains__Authorization.__contains__L       oo%%r   c                    [        U[        5      (       d  [        $ UR                  U R                  :H  =(       a9    UR                  U R                  :H  =(       a    UR
                  U R
                  :H  $ r   )
isinstancer   NotImplementedr   r   r   r   others     r   __eq__Authorization.__eq__O   sX    %//!! JJ$))# 4tzz)4  DOO3	
r   c                   U(       d  gUR                  S5      u  p#nUR                  5       nUR                  5       nUS:X  aB   [        R                  " U5      R                  5       R                  S5      u  pSnU " X%US.5      $ SUR                  S5      ;   a  U " U[        U5      S5      $ U " USU5      $ ! [        R                  [        4 a     gf = f)zParse 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_restr;   r<   s          r   from_headerAuthorization.from_headerY   s     //#.4zz|W(.(8(8(>(E(E(G(Q(QRU(V%X v(KLL$++c""v06== 64&& NNL1 s   6B7 7CCc                   U R                   S:X  aQ  [        R                  " U R                   SU R                   3R                  5       5      R                  S5      nSU 3$ U R                  b)  U R                   R                  5        SU R                   3$ U R                   R                  5        S[        U R                  5       3$ )zYProduce an ``Authorization`` header value representing this data.

.. versionadded:: 2.0
r9   r:   asciizBasic r8   )r   rA   	b64encoder;   r<   encoderC   r   titler   r   r   rI   s     r   	to_headerAuthorization.to_headerx   s    
 99$$==/4==/299;fWo  E7##::!iioo'($**66))//#$Ak$//&B%CDDr   c                "    U R                  5       $ r   rU   r   s    r   __str__Authorization.__str__       ~~r   c                V    S[        U 5      R                   SU R                  5        S3$ N<r8   >r   __name__rU   rY   s    r   __repr__Authorization.__repr__   *    4:&&'q)9(:!<<r   )r   r   r   NN)r   strr   dict[str, str | None] | Noner   
str | NonereturnNoner   rg   rj   ri   r   r&   rg   r'   ri   rj   ri   r&   rg   rj   boolr4   objectrj   ro   rI   ri   rj   zte.Self | Nonerj   rg   )rb   
__module____qualname____firstlineno____doc__r   r   r"   r   r-   r5   classmethodrM   rU   rZ   rc   __static_attributes__ r   r   r   r      sw    8 .2 	 + 	
 
0))1&
 ' '<E  =r   r   c                    ^  \ rS rSrSr  S     SS jjrSS jr\SS j5       r\R                  SS j5       r\SS j5       r
\
R                  SS j5       r
\S S	 j5       r\R                  S!S
 j5       rS"S jrS#S jrS$S jrS%S jrS&U 4S jjrS'S jrS(S jrS)S jrS*S+S jjr\S,S j5       rSS jrSS jrSS jrSrU =r$ )-WWWAuthenticate   a  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                v   ^  UR                  5       T l        [        UU 4S j5      T l        UT l        S T l        g )Nc                $   > TR                  5       $ r   _trigger_on_updaterK   r   s    r   <lambda>*WWWAuthenticate.__init__.<locals>.<lambda>   s    d557r   )r?   _typer	   _parameters_token
_on_update)r   r   valuesr   s   `   r   r   WWWAuthenticate.__init__   s6     __&
2>73
 IMr   c                B    U R                   b  U R                  U 5        g g r   )r   rY   s    r   r   "WWWAuthenticate._trigger_on_update   s    ??&OOD! 'r   c                    U R                   $ )zDThe authorization scheme, like ``basic``, ``digest``, or ``bearer``.)r   rY   s    r   r   WWWAuthenticate.type   s     zzr   c                0    Xl         U R                  5         g r   )r   r   rT   s     r   r   r      s    
!r   c                    U R                   $ zoA dict of parameters for the header. Only one of this or :attr:`token` should
have a value for a given scheme.
)r   rY   s    r   r   WWWAuthenticate.parameters   s    
 r   c                P   ^  [        UU 4S j5      T l        T R                  5         g )Nc                $   > TR                  5       $ r   r   r   s    r   r   ,WWWAuthenticate.parameters.<locals>.<lambda>   s    9P9P9Rr   )r	   r   r   rT   s   ` r   r   r      s    '/RS!r   c                    U R                   $ r   )r   rY   s    r   r   WWWAuthenticate.token   s    
 {{r   c                0    Xl         U R                  5         g)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)r   r   rT   s     r   r   r      s     !r   c                8    U R                   R                  U5      $ r   r   r,   s     r   r"   WWWAuthenticate.__getitem__   s    ""3''r   c                    Uc  XR                   ;   a  U R                   U	 OX R                   U'   U R                  5         g r   r   r   )r   r&   rI   s      r   __setitem__WWWAuthenticate.__setitem__   s6    =oo%OOC(#(OOC !r   c                ^    XR                   ;   a  U R                   U	 U R                  5         g g r   r   r,   s     r   __delitem__WWWAuthenticate.__delitem__   s)    //!$##% "r   c                
    X   $ r   rz   r   s     r   r   WWWAuthenticate.__getattr__   s
    zr   c                :   > US;   a  [         TU ]  X5        g X U'   g )N>   r   r   r   r   )super__setattr__)r   r   rI   	__class__s      r   r   WWWAuthenticate.__setattr__   s     CCG,Jr   c                    X	 g r   rz   r   s     r   __delattr__WWWAuthenticate.__delattr__   s    Jr   c                    XR                   ;   $ r   r+   r,   s     r   r-   WWWAuthenticate.__contains__   r/   r   c                    [        U[        5      (       d  [        $ UR                  U R                  :H  =(       a9    UR                  U R                  :H  =(       a    UR
                  U R
                  :H  $ r   )r1   r|   r2   r   r   r   r3   s     r   r5   WWWAuthenticate.__eq__  sX    %11!! JJ$))# 4tzz)4  DOO3	
r   c                8    U R                   R                  X5      $ r   r   r%   s      r   r   WWWAuthenticate.get  r)   r   c                    U(       d  gUR                  S5      u  p#nUR                  5       nUR                  5       nSUR                  S5      ;   a  U " U[	        U5      S5      $ U " USU5      $ )zParse 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
Nr8   r=   )r>   r?   r@   rG   r   )rH   rI   rJ   rK   rL   s        r   rM   WWWAuthenticate.from_header  si     //#.4zz|$++c""v06== 64&&r   c                   U R                   b)  U R                  R                  5        SU R                    3$ U R                  S:X  ak  / nU R                  R	                  5        H7  u  p#US;   a  [        USS9nO[        U5      nUR                  U SU 35        M9     SSR                  U5       3$ U R                  R                  5        S[        U R                  5       3$ )	zCProduce a ``WWW-Authenticate`` header value representing this data.r8   digest>   qopnoncerealmdomainopaqueF)allow_tokenr=   zDigest z, )	r   r   rS   r   itemsr   appendjoinr   )r   r   r&   rI   s       r   rU   WWWAuthenticate.to_header%  s    ::!iioo'($**6699 E"oo335
GG.u%HE.u5EuAeW-. 6 TYYu-.//))//#$Ak$//&B%CDDr   c                "    U R                  5       $ r   rX   rY   s    r   rZ   WWWAuthenticate.__str__9  r\   r   c                V    S[        U 5      R                   SU R                  5        S3$ r^   ra   rY   s    r   rc   WWWAuthenticate.__repr__<  re   r   )r   r   r   r   rf   )r   rg   r   rh   r   ri   )rj   rk   rs   )rI   rg   rj   rk   )rj   zdict[str, str | None])rI   zdict[str, str]rj   rk   )rj   ri   )rI   ri   rj   rk   )r&   rg   rj   ri   )r&   rg   rI   ri   rj   rk   )r&   rg   rj   rk   rl   )r   rg   rI   ri   rj   rk   )r   rg   rj   rk   rn   rp   r   rm   rr   )rb   rt   ru   rv   rw   r   r   propertyr   setterr   r   r"   r   r   r   r   r   r-   r5   r   rx   rM   rU   rZ   rc   ry   __classcell__)r   s   @r   r|   r|      s   8 04 	NN -N 	N"   
[[" "     " "   \\" "("&
&
1 ' ',E( = =r   r|   )
__future__r   rA   rD   collections.abcabccabctypingthttpr   r   r   
structuresr	   TYPE_CHECKINGtyping_extensionster   r|   rz   r   r   <module>r      sC    "      $ % $??"{= {=|n= n=r   