File: //lib/python3/dist-packages/oauthlib/oauth2/rfc6749/clients/__pycache__/base.cpython-310.pyc
o
���a�g � @ s� d Z ddlZddlZddlZddlZddlZddlZddlmZ ddl m
Z
ddlmZm
Z
ddlmZmZmZ ddlmZ dZd Zd
ZddiZG d
d� d�ZdS )z�
oauthlib.oauth2.rfc6749
~~~~~~~~~~~~~~~~~~~~~~~
This module is an implementation of various logic needed
for consuming OAuth 2.0 RFC6749.
� N)�generate_token)�tokens)�InsecureTransportError�TokenExpiredError)�parse_token_response�prepare_token_request� prepare_token_revocation_request)�is_secure_transport�auth_header�query�bodyzContent-Typez!application/x-www-form-urlencodedc @ s e Zd ZdZdZedddddddddedddfdd�Zedd� �Z d d
� Z
dd� Zd
d� Z d.dd�Z
d/dd�Z d0dd�Z d1dd�Z d2dd�Zd3dd�Zd4dd�Z d.d d!�Zd"d#� Zd3d$d%�Zdddedfd&d'�Zd(d)� Zd*d+� Zd,d-� ZdS )5�Clienta� Base OAuth2 client responsible for access token management.
This class also acts as a generic interface providing methods common to all
client types such as ``prepare_authorization_request`` and
``prepare_token_revocation_request``. The ``prepare_x_request`` methods are
the recommended way of interacting with clients (as opposed to the abstract
prepare uri/body/etc methods). They are recommended over the older set
because they are easier to use (more consistent) and add a few additional
security checks, such as HTTPS and state checking.
Some of these methods require further implementation only provided by the
specific purpose clients such as
:py:class:`oauthlib.oauth2.MobileApplicationClient` and thus you should always
seek to use the client class matching the OAuth workflow you need. For
Python, this is usually :py:class:`oauthlib.oauth2.WebApplicationClient`.
�
refresh_token�BearerNc K s� || _ || _|| _|| _|| _|| _|| _|pi | _| | _|| _ |
| _
|| _|
| _|| _
|| _d| _d| _d| _| �| j� dS )ae Initialize a client with commonly used attributes.
:param client_id: Client identifier given by the OAuth provider upon
registration.
:param default_token_placement: Tokens can be supplied in the Authorization
header (default), the URL query component (``query``) or the request
body (``body``).
:param token_type: OAuth 2 token type. Defaults to Bearer. Change this
if you specify the ``access_token`` parameter and know it is of a
different token type, such as a MAC, JWT or SAML token. Can
also be supplied as ``token_type`` inside the ``token`` dict parameter.
:param access_token: An access token (string) used to authenticate
requests to protected resources. Can also be supplied inside the
``token`` dict parameter.
:param refresh_token: A refresh token (string) used to refresh expired
tokens. Can also be supplied inside the ``token`` dict parameter.
:param mac_key: Encryption key used with MAC tokens.
:param mac_algorithm: Hashing algorithm for MAC tokens.
:param token: A dict of token attributes such as ``access_token``,
``token_type`` and ``expires_at``.
:param scope: A list of default scopes to request authorization for.
:param state: A CSRF protection string used during authorization.
:param redirect_url: The redirection endpoint on the client side to which
the user returns after authorization.
:param state_generator: A no argument state generation callable. Defaults
to :py:meth:`oauthlib.common.generate_token`.
:param code_verifier: PKCE parameter. A cryptographically random string that is used to correlate the
authorization request to the token request.
:param code_challenge: PKCE parameter. A challenge derived from the code verifier that is sent in the
authorization request, to be verified against later.
:param code_challenge_method: PKCE parameter. A method that was used to derive code challenge.
Defaults to "plain" if not present in the request.
N)� client_id�default_token_placement�
token_type�access_tokenr �mac_key�
mac_algorithm�token�scope�state_generator�state�redirect_url�
code_verifier�code_challenge�code_challenge_method�code�
expires_in�_expires_at�populate_token_attributes)�selfr r r r r r r r r r r r r r r �kwargs� r$ �F/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/clients/base.py�__init__8 s&