o
    ‘¸õaÿ  ã                   @   sB   d Z ddlZddlmZ ddlmZ e e¡ZG dd„ deƒZ	dS )	z±
oauthlib.oauth1.rfc5849.endpoints.signature_only
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This module is an implementation of the signing logic of OAuth 1.0 RFC 5849.
é    Né   )Úerrorsé   )ÚBaseEndpointc                   @   s   e Zd ZdZ		ddd„ZdS )ÚSignatureOnlyEndpointz>An endpoint only responsible for verifying an oauth signature.ÚGETNc           
   
   C   sB  z
|   ||||¡}W n tjy% } zt d| ¡ W Y d}~dS d}~ww z|  |¡ |  |¡ W n tjyP } zt d| ¡ d|fW  Y d}~S d}~ww | j |j	|j
|j|¡sft d¡ d|fS | j |j	|¡}|su| jj|_	|  |¡}||jd< ||jd< t||fƒ}	|	s�t d¡ t d	|¡ t d
|¡ |	|fS )a°  Validate a signed OAuth request.

        :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.
        :returns: A tuple of 2 elements.
                  1. True if valid, False otherwise.
                  2. An oauthlib.common.Request object.
        z.Exception caught while validating request, %s.N)FNFz.[Failure] verification failed: timestamp/nonceÚclientÚ	signaturez&[Failure] request verification failed.zValid client: %szValid signature: %s)Ú_create_requestr   ÚOAuth1ErrorÚlogÚinfoÚ_check_transport_securityÚ_check_mandatory_parametersÚrequest_validatorÚvalidate_timestamp_and_nonceÚ
client_keyÚ	timestampÚnonceÚdebugÚvalidate_client_keyÚdummy_clientÚ_check_signatureÚvalidator_logÚall)
ÚselfÚuriÚhttp_methodÚbodyÚheadersÚrequestÚerrÚvalid_clientÚvalid_signatureÚv© r%   úR/usr/lib/python3/dist-packages/oauthlib/oauth1/rfc5849/endpoints/signature_only.pyÚvalidate_request   sL   ÿ€ý
ÿ€ýÿ
	ÿ




z&SignatureOnlyEndpoint.validate_request)r   NN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r'   r%   r%   r%   r&   r      s
    ÿr   )
r+   ÚloggingÚ r   Úbaser   Ú	getLoggerr(   r   r   r%   r%   r%   r&   Ú<module>   s   
