+
    VùCi+  ã                   óÜ   € R t ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RIH	t	 ^ RI
HtHt ^RIHt  ! R R]4      tRR	 ltR
 tRR ltRR ltRR ltR tR t ! R R4      t ! R R]4      tR# )zÿ
oauthlib.oauth2.rfc6749.tokens
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This module contains methods for adding two types of access tokens to requests.

- Bearer https://tools.ietf.org/html/rfc6750
- MAC https://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-01
N)Ú
b2a_base64)Úurlparse)Úcommon)Úadd_params_to_qsÚadd_params_to_uri)Úutilsc                   ó¦   a a€ ] tR t^t oR
V 3R llt]R 4       t]R 4       t]R 4       t]R 4       t	]R 4       t
]R 4       t]R 4       tR	tVtV ;t# )ÚOAuth2Tokenc                óp  <€ \         SV `  V4       R V n        VP                  R4      '       d,   \	        \
        P                  ! VR,          4      4      V n        VeH   \	        \
        P                  ! V4      4      V n        V P                  f   V P                  V n        R # R # V P                  V n        R # )NÚscope)ÚsuperÚ__init__Ú
_new_scopeÚgetÚsetr   Úscope_to_listÚ
_old_scope)ÚselfÚparamsÚ	old_scopeÚ	__class__s   &&&€Ú@/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/tokens.pyr   ÚOAuth2Token.__init__   s‡   ø€ Ü‰Ñ˜Ô ØˆŒØ�:‰:�g×ÒÜ!¤%×"5Ò"5°f¸WµoÓ"FÓGˆDŒOØÒ Ü!¤%×"5Ò"5°iÓ"@ÓAˆDŒOØ�‰Ò&ð #'§/¡/�–ñ 'ð
 #Ÿo™oˆDŽOó    c                ó4   € V P                   V P                  8g  # ©N©r   r   ©r   s   &r   Úscope_changedÚOAuth2Token.scope_changed&   s   € à�‰ $§/¡/Ñ1Ð1r   c                óB   € \         P                  ! V P                  4      # r   )r   Úlist_to_scoper   r   s   &r   r   ÚOAuth2Token.old_scope*   ó   € ä×"Ò" 4§?¡?Ó3Ð3r   c                ó,   € \        V P                  4      # r   )Úlistr   r   s   &r   Ú
old_scopesÚOAuth2Token.old_scopes.   ó   € ä�D—O‘OÓ$Ð$r   c                óB   € \         P                  ! V P                  4      # r   )r   r!   r   r   s   &r   r   ÚOAuth2Token.scope2   r#   r   c                ó,   € \        V P                  4      # r   )r%   r   r   s   &r   ÚscopesÚOAuth2Token.scopes6   r(   r   c                óN   € \        V P                  V P                  ,
          4      # r   )r%   r   r   r   s   &r   Úmissing_scopesÚOAuth2Token.missing_scopes:   ó   € ä�D—O‘O d§o¡oÕ5Ó6Ð6r   c                óN   € \        V P                  V P                  ,
          4      # r   )r%   r   r   r   s   &r   Úadditional_scopesÚOAuth2Token.additional_scopes>   r1   r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   Úpropertyr   r   r&   r   r,   r/   r3   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r   Ú__classdict__s   @@r   r	   r	      s›   ù‡ € ÷.ð ñ2ó ð2ð ñ4ó ð4ð ñ%ó ð%ð ñ4ó ð4ð ñ%ó ð%ð ñ7ó ð7ð ñ7ó ÷7ð 7r   r	   c                ó  € VP                  4       p\        P                  ! V4      w  r¼VP                  4       R8X  d   \        P
                  pM1VP                  4       R8X  d   \        P                  pM\        R4      hV
^ 8X  dE   T;'       g:    RP                  \        P                  ! V	4      \        P                  ! 4       4      pM*\        P                  ! 4       p\        P                  ! 4       p\        V4      w  ppppppV'       d   VR,           V,           MTpVeK   V
^ 8X  dD   VP                  R4      p\        V! V4      P!                  4       4      RR P#                  R4      pMRp. pV
^ 8X  d   VP%                  V4       M"VP%                  X4       VP%                  V4       VP%                  VP                  4       4       VP%                  V4       VP%                  V4       VP%                  V4       V
^ 8X  d   VP%                  V4       TP%                  T;'       g    R4       R	P'                  V4      R	,           p\)        V\*        4      '       d   VP                  R4      p\,        P.                  ! VVP                  R4      V4      p\        VP!                  4       4      RR P#                  R4      p. pVP%                  R
V ,          4       V
^ 8w  d   VP%                  RX,          4       VP%                  RV,          4       V'       d   VP%                  RV,          4       V'       d   VP%                  RV,          4       VP%                  RV,          4       T;'       g    / pRP'                  V4      VR&   V# )aû  Add an `MAC Access Authentication`_ signature to headers.

Unlike OAuth 1, this HMAC signature does not require inclusion of the
request payload/body, neither does it use a combination of client_secret
and token_secret but rather a mac_key provided together with the access
token.

Currently two algorithms are supported, "hmac-sha-1" and "hmac-sha-256",
`extension algorithms`_ are not supported.

Example MAC Authorization header, linebreaks added for clarity

Authorization: MAC id="h480djs93hd8",
                   nonce="1336363200:dj83hs9s",
                   mac="bhCQXTVyfj5cmA9uKkPFx1zeOXM="

.. _`MAC Access Authentication`: https://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-01
.. _`extension algorithms`: https://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-01#section-7.1

:param token:
:param uri: Request URI.
:param key: MAC given provided by token endpoint.
:param http_method: HTTP Request method.
:param nonce:
:param headers: Request headers as a dictionary.
:param body:
:param ext:
:param hash_algorithm: HMAC algorithm provided by token endpoint.
:param issue_time: Time when the MAC credentials were issued (datetime).
:param draft: MAC authentication specification version.
:return: headers dictionary with the authorization field added.
ú
hmac-sha-1zhmac-sha-256zunknown hash algorithmz{}:{}Ú?Nzutf-8Ú Ú
zMAC id="%s"zts="%s"z
nonce="%s"zbodyhash="%s"zext="%s"zmac="%s"z, ÚAuthorizationéÿÿÿÿ)Úupperr   Úhost_from_uriÚlowerÚhashlibÚsha1Úsha256Ú
ValueErrorÚformatÚgenerate_ager   Úgenerate_nonceÚgenerate_timestampr   Úencoder   ÚdigestÚdecodeÚappendÚjoinÚ
isinstanceÚstrÚhmacÚnew)ÚtokenÚuriÚkeyÚhttp_methodÚnonceÚheadersÚbodyÚextÚhash_algorithmÚ
issue_timeÚdraftÚhostÚportÚhÚtsÚschÚnetÚpathÚparÚqueryÚfraÚrequest_uriÚbodyhashÚbaseÚbase_stringÚsignÚheaders   &&&&&&&&&&&                r   Úprepare_mac_headerrt   C   sÇ  € ðP ×#Ñ#Ó%€KÜ×$Ò$ SÓ)�J€Dà×ÑÓ Ô-Ü�L‰L‰Ø	×	Ñ	Ó	 >Ô	1Ü�N‰N‰äÐ1Ó2Ð2à�„zØ÷ Cð C˜Ÿ™¬×(:Ò(:¸:Ó(FÜ*0×*?Ò*?Ó*AóC‰ô ×&Ò&Ó(ˆÜ×%Ò%Ó'ˆä&.¨s£mÑ#€Cˆˆd�C˜ ç(-�$˜•*˜uÖ$°4€Kð Ò˜E QœJØ�{‰{˜7Ó#ˆÜ™a ›gŸn™nÓ.Ó/°°Ð4×;Ñ;¸GÓD‰àˆð €DØ�„zØ�‰�EÕà�‰�BŒØ�‰�EÔØ‡K�K�×!Ñ!Ó#Ô$Ø‡K�K�ÔØ‡K�K�ÔØ‡K�K�ÔØ�„zØ�‰�HÔØ‡K�K�—	�	�rÔØ—)‘)˜D“/ DÕ(€Kô �#”s×ÒØ�j‰j˜Ó!ˆÜ�8Š8�C˜×+Ñ+¨GÓ4°aÓ8€DÜ�d—k‘k“mÓ$ S bÐ)×0Ñ0°Ó9€Dà€FØ
‡M�M�- %Õ'Ô(Ø�„zØ�‰�i "•nÔ%Ø
‡M�M�, Õ&Ô'ßØ�‰�o¨Õ0Ô1ß
Ø�‰�j 3Õ&Ô'Ø
‡M�M�*˜tÕ#Ô$à�mˆm˜€GØ#Ÿy™y¨Ó0€GˆOÑØ€Nr   c                ó    € \        VRV 3.4      # )a  Add a `Bearer Token`_ to the request URI.
Not recommended, use only if client can't use authorization header or body.

http://www.example.com/path?access_token=h480djs93hd8

.. _`Bearer Token`: https://tools.ietf.org/html/rfc6750

:param token:
:param uri:
Úaccess_token)r   )rY   rZ   s   &&r   Úprepare_bearer_urirw   ­   s   € ô ˜S ^°UÐ$;Ð"=Ó>Ð>r   c                ó6   € T;'       g    / pRV ,          VR&   V# )zÓAdd a `Bearer Token`_ to the request URI.
Recommended method of passing bearer tokens.

Authorization: Bearer h480djs93hd8

.. _`Bearer Token`: https://tools.ietf.org/html/rfc6750

:param token:
:param headers:
z	Bearer %srC   © )rY   r^   s   &&r   Úprepare_bearer_headersrz   »   s#   € ð �mˆm˜€GØ*¨UÕ2€GˆOÑØ€Nr   c                ó    € \        VRV 3.4      # )z›Add a `Bearer Token`_ to the request body.

access_token=h480djs93hd8

.. _`Bearer Token`: https://tools.ietf.org/html/rfc6750

:param token:
:param body:
rv   )r   )rY   r_   s   &&r   Úprepare_bearer_bodyr|   Ë   s   € ô ˜D ^°UÐ$;Ð"=Ó>Ð>r   c                ó,   € \         P                  ! 4       # )z`
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:param refresh_token:
)r   Úgenerate_token)ÚrequestÚrefresh_tokens   &&r   Úrandom_token_generatorr�   Ø   s   € ô × Ò Ó"Ð"r   c                ó   a a€ VV 3R lpV# )z
:param private_pem:
c                 ó@   <€ SV n         \        P                  ! SV 4      # r   )Úclaimsr   Úgenerate_signed_token)r   ÚkwargsÚprivate_pems   &€€r   Úsigned_token_generatorÚ6signed_token_generator.<locals>.signed_token_generatorå   s   ø€ ØˆŒÜ×+Ò+¨K¸ÓAÐAr   ry   )r‡   r†   rˆ   s   fl r   rˆ   rˆ   á   s   ù€ öBð "Ð!r   c                ó  € RpRV P                   9   da   V P                   P                  R4      P                  4       p\        V4      ^8X  d&   V^ ,          P	                  4       R8X  d
   V^,          pV# V P
                  pV# )zÓ
Helper function to extract a token from the request header.

:param request: OAuthlib request.
:type request: oauthlib.common.Request
:return: Return the token or None if the Authorization header is malformed.
NrC   Úbearer)r^   r   ÚsplitÚlenrG   rv   )r   rY   Úsplit_headers   &  r   Úget_token_from_headerr�   ì   su   € ð €Eà˜'Ÿ/™/Ô)Ø—‘×*Ñ*¨?Ó;×AÑAÓCˆÜˆ|Ó Ô! l°1¥o×&;Ñ&;Ó&=ÀÔ&IØ  •OˆEð €Lð ×$Ñ$ˆà€Lr   c                   ó:   a € ] tR tRt o RtRR ltR tR tRtV t	R# )Ú	TokenBaseé   c                ó   € \        R 4      h)ú&Subclasses must implement this method.©ÚNotImplementedError)r   r   r€   s   &&&r   Ú__call__ÚTokenBase.__call__  s   € Ü!Ð"JÓKÐKr   c                ó   € \        R4      h©úJ
:param request: OAuthlib request.
:type request: oauthlib.common.Request
r”   r•   ©r   r   s   &&r   Úvalidate_requestÚTokenBase.validate_request  ó   € ô
 "Ð"JÓKÐKr   c                ó   € \        R4      hrš   r•   rœ   s   &&r   Úestimate_typeÚTokenBase.estimate_type  rŸ   r   ry   N©F)
r5   r6   r7   r8   Ú	__slots__r—   r�   r¡   r:   r;   ©r=   s   @r   r‘   r‘      s"   ø‡ € Ø€IôLòL÷Lð Lr   r‘   c                   óD   a € ] tR tRt o RtR	R ltR
R ltR tR tRt	V t
R# )ÚBearerTokeni  Nc                ó”   € Wn         T;'       g    \        V n        T;'       g    V P                  V n        T;'       g    R V n        R# )i  N)Úrequest_validatorr�   Útoken_generatorÚrefresh_token_generatorÚ
expires_in)r   r©   rª   r¬   r«   s   &&&&&r   r   ÚBearerToken.__init__  sC   € à!2ÔØ.×HÐHÔ2HˆÔà#×;Ð; t×';Ñ';ð 	Ô$ð %×,Ð,¨ˆŽr   c                óf  € RV9   d   \         P                  ! R\        4       \        V P                  4      '       d   V P	                  V4      MV P                  pWAn        RV P                  V4      RVRR/pVP                  e   RP                  VP                  4      VR&   V'       dX   VP                  '       d2   V P                  P                  V4      '       g   VP                  VR	&   MV P                  V4      VR	&   TP                  VP                  ;'       g    / 4       \        V4      # )
z™
Create a BearerToken, by default without refresh token.

:param request: OAuthlib request.
:type request: oauthlib.common.Request
:param refresh_token:
Ú
save_tokenzx`save_token` has been deprecated, it was not called internally.If you do, call `request_validator.save_token()` instead.rv   r¬   Ú
token_typeÚBearerÚ r   r€   )ÚwarningsÚwarnÚDeprecationWarningÚcallabler¬   rª   r,   rT   r€   r©   Úrotate_refresh_tokenr«   ÚupdateÚextra_credentialsr	   )r   r   r€   r†   r¬   rY   s   &&&,  r   Úcreate_tokenÚBearerToken.create_token$  s  € ð ˜6Ô!Ü�MŠMð Vä,ô.ô 2:¸$¿/¹/×1JÒ1J�T—_‘_ WÔ-ÐPT×P_ÑP_ˆ
à'Ôð ˜D×0Ñ0°Ó9Ø˜*Ø˜(ð
ˆð �>‰>Ò%Ø ŸX™X g§n¡nÓ5ˆE�'‰NçØ×%×%Ð%Ø×.Ñ.×CÑCÀG×LÒLØ)0×)>Ñ)>��oÒ&à)-×)EÑ)EÀgÓ)N��oÑ&à�‰�W×.Ñ.×4Ð4°"Ô5Ü˜5Ó!Ð!r   c                ód   € \        V4      pV P                  P                  W!P                  V4      # )r›   )r�   r©   Úvalidate_bearer_tokenr,   )r   r   rY   s   && r   r�   ÚBearerToken.validate_requestK  s0   € ô
 & gÓ.ˆØ×%Ñ%×;Ñ;Ø—>‘> 7ó,ð 	,r   c                ó´   € VP                   P                  RR4      P                  R4      ^ ,          P                  4       R8X  d   ^	# VP                  e   ^# ^ # )r›   rC   rA   r²   r‹   )r^   r   rŒ   rG   rv   rœ   s   &&r   r¡   ÚBearerToken.estimate_typeT  sK   € ð
 �?‰?×Ñ˜°Ó3×9Ñ9¸#Ó>¸qÕA×GÑGÓIÈXÔUÙØ×!Ñ!Ò-Ùár   )r¬   r«   r©   rª   )r©   rª   r«   r¬   )NNNNr£   )r5   r6   r7   r8   r¤   r   rº   r�   r¡   r:   r;   r¥   s   @r   r§   r§     s&   ø‡ € ð€Iô
-ô%"òN,÷
ð 
r   r§   )NNNrA   r?   Né    r   )rA   r£   )Ú__doc__rH   rW   r³   Úbinasciir   Úurllib.parser   Úoauthlibr   Úoauthlib.commonr   r   rA   r   Údictr	   rt   rw   rz   r|   r�   rˆ   r�   r‘   r§   ry   r   r   Ú<module>rÈ      sp   ðñó Û Û Ý Ý !å ß ?å ô*7�$ô *7ôZgòT?ôô 
?ô#ò"ò÷(Lñ Lô*I�)ö Ir   