1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
U
Þ=®d¨>ã@súddlmZddlZddlZddlZddlZddlmZddl    m
Z
ddl    m Z ddl    m Z ddl    m Z d    d
lmZd    d lmZejrŽddlZGd d „d ƒZdddddœdd„ZGdd„dƒZdd„ZdD]*ZeeeeƒƒZeeeeƒeeeeƒqÊdS)é)Ú annotationsN©Úwrapsé)Ú dump_header)Úparse_dict_header)Úparse_set_header)Úquote_header_valueé)Ú CallbackDict)Ú    HeaderSetc@s¸eZdZdZd%dddddœdd    „Zddd
œd d „Zddd
œd d„Zd&ddddœdd„Zdddœdd„Zdddœdd„Z    e
dddœdd„ƒZ ddœdd „Z ddœd!d"„Z ddœd#d$„ZdS)'Ú 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.
    NÚstrúdict[str, str] | Noneú
str | NoneÚNone)Ú    auth_typeÚdataÚtokenÚreturncCs"||_|dkri}||_||_dS©N)ÚtypeÚ
parametersr)Úselfrrr©rúSd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\werkzeug/datastructures/auth.pyÚ__init__.s zAuthorization.__init__©ÚnamercCs |j |¡Sr©rÚget©rrrrrÚ __getattr__FszAuthorization.__getattr__cCs |j |¡Srrr!rrrÚ __getitem__IszAuthorization.__getitem__©ÚkeyÚdefaultrcCs|j ||¡Srr©rr%r&rrrr LszAuthorization.getÚbool©r%rcCs
||jkSr©r©rr%rrrÚ __contains__OszAuthorization.__contains__Úobject©ÚotherrcCs2t|tƒstS|j|jko0|j|jko0|j|jkSr)Ú
isinstancer ÚNotImplementedrrr©rr/rrrÚ__eq__Rs
 
ÿ
ýzAuthorization.__eq__úte.Self | None©Úvaluerc    Cs¦|sdS| d¡\}}}| ¡}| ¡}|dkr|zt |¡ ¡ d¡\}}}Wntjtfk
rjYdSX||||dœƒSd|     d¡krš||t
|ƒdƒS||d|ƒS)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)Úclsr6ÚschemeÚ_Úrestr:r;rrrÚ from_header\s    zAuthorization.from_header©rcCsp|jdkr6t |j›d|j› ¡¡ d¡}d|›S|jdk    rV|j ¡›d|j›S|j ¡›dt    |j
ƒ›S)ziProduce an ``Authorization`` header value representing this data.
 
        .. versionadded:: 2.0
        r8r9Úutf8zBasic Nr7) rr@Ú    b64encoder:r;ÚencoderBrÚtitlerr©rr6rrrÚ    to_header{s
ÿþ
 
zAuthorization.to_headercCs| ¡Sr©rR©rrrrÚ__str__‹szAuthorization.__str__cCsdt|ƒj›d| ¡›dS©Nú<r7ú>©rÚ__name__rRrTrrrÚ__repr__ŽszAuthorization.__repr__)NN)N)rZÚ
__module__Ú __qualname__Ú__doc__rr"r#r r,r3Ú classmethodrKrRrUr[rrrrr sü
r rrÚproperty)rÚdocrcs2tjdtdd‡fdd„}t‡fdd„||dS)    a*A static helper function for Authentication subclasses to add
    extra authentication system properties onto a class::
 
        class FooAuthenticate(WWWAuthenticate):
            special_realm = auth_property('special_realm')
 
    .. deprecated:: 2.3
        Will be removed in Werkzeug 3.0.
    zB'auth_property' is deprecated and will be removed in Werkzeug 3.0.r©Ú
stacklevelcs&|dkr| ˆd¡n t|ƒ|ˆ<dSr)ÚpoprrQ©rrrÚ
_set_value¢sz!auth_property.<locals>._set_valuecs
| ˆ¡Sr)r )ÚxrerrÚ<lambda>¨ózauth_property.<locals>.<lambda>)ra)ÚwarningsÚwarnÚDeprecationWarningr`)rrarfrrerÚ auth_property’s
ý rmc    søeZdZdZdMddddœdd„Zdd    œd
d „Zed d    œd d„ƒZejd ddœdd„ƒZedd    œdd„ƒZ    e    jdddœdd„ƒZ    edd    œdd„ƒZ
e
jdddœdd„ƒZ
dNd ddœdd„Z dOd d dddddd œd!d"„Z d dd#œd$d%„Z d ddd&œd'd(„Zd dd#œd)d*„Zd dd+œd,d-„Zd ddd.œ‡fd/d0„ Zd dd+œd1d2„Zd dd#œd3d4„Zd5dd6œd7d8„ZdPd ddd9œd:d;„Zedd<dœd=d>„ƒZd d    œd?d@„Zd d    œdAdB„Zd d    œdCdD„ZedEd    œdFdG„ƒZedHd    œdIdJ„ƒZejdKddœdLdJ„ƒZeeƒZ‡ZS)QÚ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.
    Nrr)rÚvaluesrcsJ|dkrtjdtddd}| ¡ˆ_t|‡fdd„ƒˆ_|ˆ_dˆ_dS)NzvAn auth type must be given as the first parameter. Assuming 'basic' is deprecated and will be removed in Werkzeug 3.0.rrbr8csˆ ¡Sr©Ú_trigger_on_update©rIrTrrrhÖriz*WWWAuthenticate.__init__.<locals>.<lambda>)    rjrkrlr>Ú_typer Ú _parametersÚ_tokenÚ
_on_update)rrrorrrTrrÅsü
 
ÿzWWWAuthenticate.__init__rrLcCs|jdk    r| |¡dSr)rvrTrrrrqÛs
z"WWWAuthenticate._trigger_on_updatercCs|jS)zDThe authorization scheme, like ``Basic``, ``Digest``, or ``Bearer``.)rsrTrrrrßszWWWAuthenticate.typer5cCs||_| ¡dSr)rsrqrQrrrräszdict[str, str]cCs|jS©z~A dict of parameters for the header. Only one of this or :attr:`token` should
        have a value for a give scheme.
        )rtrTrrrrészWWWAuthenticate.parameterscs t|‡fdd„ƒˆ_ˆ ¡dS)Ncsˆ ¡SrrprrrTrrrhóriz,WWWAuthenticate.parameters.<locals>.<lambda>)r rtrqrQrrTrrðs
 
ÿcCs|jSrw)rurTrrrr÷szWWWAuthenticate.tokencCs||_| ¡dS)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)rurqrQrrrrþsúauthentication required)ÚrealmrcCs@t d¡d|_t |j¡t |jd|i¡d|_| ¡dS)z°Clear any existing data and set a ``Basic`` challenge.
 
        .. deprecated:: 2.3
            Will be removed in Werkzeug 3.0. Create and assign an instance instead.
        zpThe 'set_basic' method is deprecated and will be removed in Werkzeug 3.0. Create and assign an instance instead.r8ryN)    rjrkrsÚdictÚclearrÚupdaterurq)rryrrrÚ    set_basicsÿ þzWWWAuthenticate.set_basic©ÚauthFzt.Sequence[str]r()ryÚnonceÚqopÚopaqueÚ    algorithmÚstalercCsxt d¡d|_t |j¡||d |¡|r0dnddœ}|dk    rH||d<|dk    rX||d    <t |j|¡d|_|     ¡dS)
z±Clear any existing data and set a ``Digest`` challenge.
 
        .. deprecated:: 2.3
            Will be removed in Werkzeug 3.0. Create and assign an instance instead.
        zqThe 'set_digest' method is deprecated and will be removed in Werkzeug 3.0. Create and assign an instance instead.Údigestú, ÚTRUEÚFALSE)ryr€rr„Nr‚rƒ)
rjrkrsrzr{rÚjoinr|rurq)rryr€rr‚rƒr„rrrrÚ
set_digests"ÿ 
üzWWWAuthenticate.set_digestr)cCs |j |¡Srrr+rrrr#@szWWWAuthenticate.__getitem__)r%r6rcCs2|dkr||jkr&|j|=n
||j|<| ¡dSr©rrq)rr%r6rrrÚ __setitem__Cs
 
 
 
zWWWAuthenticate.__setitem__cCs||jkr|j|=| ¡dSrr‹r+rrrÚ __delitem__Ls
zWWWAuthenticate.__delitem__rcCs||Srrr!rrrr"QszWWWAuthenticate.__getattr__)rr6rcs$|dkrtƒ ||¡n|||<dS)N>rsrurvrt)ÚsuperÚ __setattr__)rrr6©Ú    __class__rrrTszWWWAuthenticate.__setattr__cCs
||=dSrrr!rrrÚ __delattr__ZszWWWAuthenticate.__delattr__cCs
||jkSrr*r+rrrr,]szWWWAuthenticate.__contains__r-r.cCs2t|tƒstS|j|jko0|j|jko0|j|jkSr)r0rnr1rrrr2rrrr3`s
 
ÿ
ýzWWWAuthenticate.__eq__r$cCs|j ||¡Srrr'rrrr jszWWWAuthenticate.getr4cCsR|sdS| d¡\}}}| ¡}| ¡}d| d¡krF||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
        Nr7r<)r=r>r?rFr)rGr6rHrIrJrrrrKms    zWWWAuthenticate.from_headercCsž|jdk    r |j ¡›d|j›S|jdkr„g}|j ¡D]:\}}|dkrVt|dd}nt|ƒ}| |›d|›¡q8dd     |¡›S|j ¡›dt|jƒ›S)
zCProduce a ``WWW-Authenticate`` header value representing this data.Nr7r…>rr€r‚ÚdomainryF)Z allow_tokenr<zDigest r†)    rrrPrÚitemsr    Úappendr‰r)rr”r%r6rrrrR„s
 
zWWWAuthenticate.to_headercCs| ¡SrrSrTrrrrU˜szWWWAuthenticate.__str__cCsdt|ƒj›d| ¡›dSrVrYrTrrrr[›szWWWAuthenticate.__repr__zset[str]cs6tjdtdddddœ‡fdd„ }tˆj d    ¡|ƒS)
z¿The ``qop`` parameter as a set.
 
        .. deprecated:: 2.3
            Will be removed in Werkzeug 3.0. It will become the same as other
            parameters, returning a string.
        z†The 'qop' property is deprecated and will be removed in Werkzeug 3.0. It will become the same as other parameters, returning a string.rrbr rr5cs(|sdˆkrˆd=dS| ¡ˆjd<dS)Nr)rRr)r6rTrrÚ    on_update­s
z&WWWAuthenticate.qop.<locals>.on_updater)rjrkrlrrr )rr–rrTrržsü    zWWWAuthenticate.qopz bool | NonecCs0tjdtddd|jkr,|jd ¡dkSdS)zÅThe ``stale`` parameter as a boolean.
 
        .. deprecated:: 2.3
            Will be removed in Werkzeug 3.0. It will become the same as other
            parameters, returning a string.
        zˆThe 'stale' property is deprecated and will be removed in Werkzeug 3.0. It will become the same as other parameters, returning a string.rrbr„ÚtrueN)rjrkrlrr>rTrrrr„¸sü
zWWWAuthenticate.stalezbool | str | NonecCsZ|dkrd|jkr|jd=dSt|tƒrLtjdtdd|r@dnd|jd<n
||jd<dS)Nr„z\Setting the 'stale' property to a boolean is deprecated and will be removed in Werkzeug 3.0.rrbr‡rˆ)rr0r(rjrkrlrQrrrr„Ìs
 
ü)NNN)rx)r~NNF)N) rZr\r]r^rrqr`rÚsetterrrr}rŠr#rŒrr"rr’r,r3r r_rKrRrUr[rr„Ú staticmethodrmÚ __classcell__rrrrrn«sZü    ù%    
rncstˆƒ‡fdd„ƒ}|S)Ncstjdtddˆ||ŽS)Nz“Treating 'Authorization' and 'WWWAuthenticate' as a dict is deprecated and will be removed in Werkzeug 3.0. Use the 'parameters' attribute instead.rrb)rjrkrl)ÚargsÚkwargs©ÚfrrÚwrapperãs üz(_deprecated_dict_method.<locals>.wrapperr)ržrŸrrrÚ_deprecated_dict_methodâs    r )
Ú__iter__r{Úcopyr”ÚkeysrdÚpopitemÚ
setdefaultr|ro)N)Ú
__future__rr@rCÚtypingÚtrjÚ    functoolsrÚhttprrrr    Ú
structuresr r Ú TYPE_CHECKINGZtyping_extensionsÚter rmrnr rÚgetattrrzržÚsetattrrrrrÚ<module>s.        ~9