Current File : //usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/endpoints/__pycache__/base.cpython-312.pyc
�

&�`"��z�dZddlZddlZddlmZmZmZmZmZm	Z	m
Z
eje�Z
Gd�d�Zd�Zy)z�
oauthlib.oauth2.rfc6749
~~~~~~~~~~~~~~~~~~~~~~~

This module is an implementation of various logic needed
for consuming and providing OAuth 2.0 RFC6749.
�N�)�FatalClientError�InvalidClientError�InvalidRequestError�OAuth2Error�ServerError�TemporarilyUnavailableError�UnsupportedTokenTypeErrorc���eZdZd�Zed��Zejd��Zed��Zejd��Zed��Zejd��Zd�Z	d	�Z
d
�Zd�Zd�Z
y
)�BaseEndpointc�.�d|_d|_d|_y)NTF)�
_available�
_catch_errors�_valid_request_methods��selfs �H/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/endpoints/base.py�__init__zBaseEndpoint.__init__s�����"���&*��#�c��|jS�N)rrs r�valid_request_methodsz"BaseEndpoint.valid_request_methodss���*�*�*rc�Z�|�|D�cgc]}|j���}}||_ycc}wr)�upperr)rr�xs   rrz"BaseEndpoint.valid_request_methodss0�� �,�8M�$N�1�Q�W�W�Y�$N�!�$N�&;��#��%Os�(c��|jSr�rrs r�	availablezBaseEndpoint.available%s�����rc��||_yrr)rrs  rrzBaseEndpoint.available)s	��#��rc��|jSr�rrs r�catch_errorszBaseEndpoint.catch_errors-s���!�!�!rc��||_yrr!)rr"s  rr"zBaseEndpoint.catch_errors1s
��)��rc�6�|js
t|d���y)zRaise error on missing token.zMissing token parameter.��request�descriptionN)�tokenr�rr&s  r�_raise_on_missing_tokenz$BaseEndpoint._raise_on_missing_token5s"���}�}�%�g�2L�N�
N�rc�F�|jj|�r>|jj|�s"tj	d|�t|���y|jj
|j|�s"tj	d|�t|���y)z&Raise on failed client authentication.z!Client authentication failed, %r.�r&N)�request_validator�client_authentication_required�authenticate_client�log�debugr�authenticate_client_id�	client_idr)s  r�_raise_on_invalid_clientz%BaseEndpoint._raise_on_invalid_client:s����!�!�@�@��I��)�)�=�=�g�F��	�	�=�w�G�(��9�9�G��'�'�>�>�w�?P�?P�RY�Z��I�I�9�7�C�$�W�5�5�[rc��|jr>|j|jvr%|j|jvrt|���yyy)zRaise on unsupported tokens.r,N)�token_type_hint�valid_token_types�supported_token_typesr
r)s  r�_raise_on_unsupported_tokenz(BaseEndpoint._raise_on_unsupported_tokenDsN���#�#��#�#�t�'=�'=�=��#�#�4�+E�+E�E�+�G�<�<�
F�
>�
$rc���|j�td��|jj�|jvr(t	|d|jj�z���y)Nz0Configure "valid_request_methods" property firstzUnsupported request method %sr%)r�
ValueError�http_methodrrr)s  r�_raise_on_bad_methodz!BaseEndpoint._raise_on_bad_methodKsf���%�%�-��O�P�P����$�$�&�d�.H�.H�H�%�g�3R�U\�Uh�Uh�Un�Un�Up�3p�s�
s�Irc�~�|jj�dk(r |jxsd}|r
t|d���yy)z/Raise if invalid POST request received
        �POST�z$URL query parameters are not allowedr%N)r<r�	uri_queryr)rr&�query_paramss   r�_raise_on_bad_post_requestz'BaseEndpoint._raise_on_bad_post_requestRsL�����$�$�&�&�0�"�,�,�2��L��)�'�7]�`�`��1rN)�__name__�
__module__�__qualname__r�propertyr�setterrr"r*r4r9r=rC�rrrrs���+�
�+��+��!�!�<�"�<��������$��$��"��"����*��*�N�
6�=�s�`rrc�B��tj���fd��}|S)Nc�~��|js1t�}tjd|z�i|jdfS|j
r	�||g|��i|��S�||g|��i|��S#t$r�t$r�t$r;}t�}tjd|z�i|jdfcYd}~Sd}~wwxYw)Nz*Endpoint unavailable, ignoring request %s.i�z.Exception caught while processing request, %s.i�)rr	r0�info�jsonr"rr�	Exceptionr�warning)�endpoint�uri�args�kwargs�e�error�fs      �r�wrapperz0catch_errors_and_unavailability.<locals>.wrapper\s�����!�!�+�-�A��H�H�A�C�G�H��q�v�v�s�?�"�� � �

+���3�8��8��8�8��X�s�4�T�4�V�4�4���
��#�
���
+�#�
�����D�q�H�J��5�:�:�s�*�*��	
+�s�A&�&B<�0B7�1B<�7B<)�	functools�wraps)rVrWs` r�catch_errors_and_unavailabilityrZ[s%����_�_�Q��5��5�(�Nr)�__doc__rX�logging�errorsrrrrrr	r
�	getLoggerrDr0rrZrIrr�<module>r_sI��������
�g����!��F`�F`�Pr