§
    ZŠtjÎ  ã                   óf   — d Z ddlZddlmZ ddlmZ  ej        e¦  «        Z G d„ de¦  «        Z	dS )	zº
oauthlib.oauth1.rfc5849.endpoints.resource
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This module is an implementation of the resource protection provider logic of
OAuth 1.0 RFC 5849.
é    Né   )Úerrorsé   )ÚBaseEndpointc                   ó   — e Zd ZdZ	 	 dd„ZdS )ÚResourceEndpointa!  An endpoint responsible for protecting resources.

    Typical use is to instantiate with a request validator and invoke the
    ``validate_protected_resource_request`` in a decorator around a view
    function. If the request is valid, invoke and return the response of the
    view. If invalid create and return an error response directly from the
    decorator.

    See :doc:`/oauth1/validator` for details on which validator methods to implement
    for this endpoint.

    An example decorator::

        from functools import wraps
        from your_validator import your_validator
        from oauthlib.oauth1 import ResourceEndpoint
        endpoint = ResourceEndpoint(your_validator)

        def require_oauth(realms=None):
            def decorator(f):
                @wraps(f)
                def wrapper(request, *args, **kwargs):
                    v, r = provider.validate_protected_resource_request(
                            request.url,
                            http_method=request.method,
                            body=request.data,
                            headers=request.headers,
                            realms=realms or [])
                    if v:
                        return f(*args, **kwargs)
                    else:
                        return abort(403)
    ÚGETNc                 ó¢  — 	 |                       ||||¦  «        }n# t          j        $ r Y dS w xY w	 |                      |¦  «         |                      |¦  «         n# t          j        $ r d|fcY S w xY w|j        sd|fS | j                             |j        ¦  «        sd|fS | j                             |j	        |j
        |j        ||j        ¬¦  «        sd|fS | j                             |j	        |¦  «        }|s| j        j        |_	        | j                             |j	        |j        |¦  «        }|s| j        j        |_        | j                             |j	        |j        ||j        |¬¦  «        }	|                      |¦  «        }
||j        d<   ||j        d<   |	|j        d<   |
|j        d<   t)          |||	|
f¦  «        }|s†t*                               d	¦  «         t*                               d
|¦  «         t*                               d|¦  «         t*                               d|	¦  «         t*                               d|
¦  «         ||fS )aœ  Create a request token response, with a new request token if valid.

        :param uri: The full URI of the token request.
        :param http_method: A valid HTTP verb, i.e. GET, POST, PUT, HEAD, etc.
        :param body: The request body as a string.
        :param headers: The request headers as a dict.
        :param realms: A list of realms the resource is protected under.
                       This will be supplied to the ``validate_realms``
                       method of the request validator.
        :returns: A tuple of 2 elements.
                  1. True if valid, False otherwise.
                  2. An oauthlib.common.Request object.
        )FNF)Úaccess_token)ÚuriÚrealmsÚclientÚresource_ownerÚrealmÚ	signaturez&[Failure] request verification failed.zValid client: %szValid token: %szValid realm: %szValid signature: %s)Ú_create_requestr   ÚOAuth1ErrorÚ_check_transport_securityÚ_check_mandatory_parametersÚresource_owner_keyÚrequest_validatorÚcheck_access_tokenÚvalidate_timestamp_and_nonceÚ
client_keyÚ	timestampÚnonceÚvalidate_client_keyÚdummy_clientÚvalidate_access_tokenÚdummy_access_tokenÚvalidate_realmsr   Ú_check_signatureÚvalidator_logÚallÚlogÚinfo)Úselfr   Úhttp_methodÚbodyÚheadersr   ÚrequestÚvalid_clientÚvalid_resource_ownerÚvalid_realmÚvalid_signatureÚvs               úh/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/oauthlib/oauth1/rfc5849/endpoints/resource.pyÚ#validate_protected_resource_requestz4ResourceEndpoint.validate_protected_resource_request5   sÃ  € ð	Ø×*Ò*¨3°¸TÀ7ÑKÔKˆGˆGøÝÔ!ð 	ð 	ð 	Ø�;�;ð	øøøð	"Ø×*Ò*¨7Ñ3Ô3Ð3Ø×,Ò,¨WÑ5Ô5Ð5Ð5øÝÔ!ð 	"ð 	"ð 	"Ø˜'�>Ð!Ð!Ð!ð	"øøøð Ô)ð 	"Ø˜'�>Ð!àÔ%×8Ò8ØÔ*ñ,ô ,ð 	"à˜'�>Ð!àÔ%×BÒBØÔ" GÔ$5°w´}ÀgØ$Ô7ð Cñ 9ô 9ð 	"ð ˜'�>Ð!ð Ô-×AÒAØÔ ñ)ô )ˆàð 	EØ!%Ô!7Ô!DˆGÔð  $Ô5×KÒKØÔ Ô :¸Gñ Eô  EÐà#ð 	SØ)-Ô)?Ô)RˆGÔ&ð0 Ô,×<Ò<¸WÔ=OØ=DÔ=WÐY`ÐfmÔfqØDJð =ñ Lô Lˆð ×/Ò/°Ñ8Ô8ˆð +7ˆÔ˜hÑ'Ø2FˆÔÐ.Ñ/Ø)4ˆÔ˜gÑ&Ø-<ˆÔ˜kÑ*õ �Ð3°[Ø ð"ñ #ô #ˆàð 	=Ý�HŠHÐ=Ñ>Ô>Ð>Ý�HŠHÐ'¨Ñ6Ô6Ð6Ý�HŠHÐ&Ð(<Ñ=Ô=Ð=Ý�HŠHÐ&¨Ñ4Ô4Ð4Ý�HŠHÐ*¨OÑ<Ô<Ð<Ø�'ˆzÐs   ‚ ›.­.²*A ÁA3Á2A3)r	   NNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r2   © ó    r1   r   r      sC   € € € € € ð ð  ðD DIØLPðnð nð nð nð nð nr8   r   )
r6   ÚloggingÚ r   Úbaser   Ú	getLoggerr3   r%   r   r7   r8   r1   ú<module>r=      sŽ   ððð ð €€€à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à€gÔ˜Ñ!Ô!€ðRð Rð Rð Rð R�|ñ Rô Rð Rð Rð Rr8   