File manager - Edit - /usr/local/CyberCP/lib/python3.10/site-packages/google/oauth2/__pycache__/credentials.cpython-310.pyc
Back
o �h�d � @ s� d Z ddlmZ ddlZddlZddlZddlZddlmZ ddlmZ ddlm Z ddlm Z ddlmZ dd lm Z e�e�Zd ZG dd� de je j�ZG d d� de j�ZdS )a� OAuth 2.0 Credentials. This module provides credentials based on OAuth 2.0 access and refresh tokens. These credentials usually access resources on behalf of a user (resource owner). Specifically, this is intended to use access tokens acquired using the `Authorization Code grant`_ and can refresh those tokens using a optional `refresh token`_. Obtaining the initial access and refresh token is outside of the scope of this module. Consult `rfc6749 section 4.1`_ for complete details on the Authorization Code grant flow. .. _Authorization Code grant: https://tools.ietf.org/html/rfc6749#section-1.3.1 .. _refresh token: https://tools.ietf.org/html/rfc6749#section-6 .. _rfc6749 section 4.1: https://tools.ietf.org/html/rfc6749#section-4.1 � )�datetimeN)� _cloud_sdk)�_helpers)�credentials)� exceptions)�metrics)�reauthz#https://oauth2.googleapis.com/tokenc sl e Zd ZdZddddddddddddddejdf� fdd� Zdd� Zdd � Ze d d� �Z e dd � �Ze dd� �Ze dd� �Z e dd� �Ze dd� �Ze dd� �Ze dd� �Ze dd� �Ze dd� �Zejdd� �Ze dd � �Ze�ej�d!d"� �Ze�ej�d#d$� �Zd%d&� Ze�ej�d'd(� �Zd)d*� Ze�ej �d+d,� �Z!e"d3d-d.��Z#e"d3d/d0��Z$d3d1d2�Z%� Z&S )4�Credentialsa� Credentials using OAuth 2.0 access and refresh tokens. The credentials are considered immutable except the tokens and the token expiry, which are updated after refresh. If you want to modify the quota project, use :meth:`with_quota_project` or :: credentials = credentials.with_quota_project('myproject-123') Reauth is disabled by default. To enable reauth, set the `enable_reauth_refresh` parameter to True in the constructor. Note that reauth feature is intended for gcloud to use only. If reauth is enabled, `pyu2f` dependency has to be installed in order to use security key reauth feature. Dependency can be installed via `pip install pyu2f` or `pip install google-auth[reauth]`. NFc s� t t| ��� || _| | _|| _|| _|| _|| _|| _ || _ || _|| _| | _ || _|| _| | _|| _|p8tj| _|p=d| _dS )a Args: token (Optional(str)): The OAuth 2.0 access token. Can be None if refresh information is provided. refresh_token (str): The OAuth 2.0 refresh token. If specified, credentials can be refreshed. id_token (str): The Open ID Connect ID Token. token_uri (str): The OAuth 2.0 authorization server's token endpoint URI. Must be specified for refresh, can be left as None if the token can not be refreshed. client_id (str): The OAuth 2.0 client ID. Must be specified for refresh, can be left as None if the token can not be refreshed. client_secret(str): The OAuth 2.0 client secret. Must be specified for refresh, can be left as None if the token can not be refreshed. scopes (Sequence[str]): The scopes used to obtain authorization. This parameter is used by :meth:`has_scopes`. OAuth 2.0 credentials can not request additional scopes after authorization. The scopes must be derivable from the refresh token if refresh information is provided (e.g. The refresh token scopes are a superset of this or contain a wild card scope like 'https://www.googleapis.com/auth/any-api'). default_scopes (Sequence[str]): Default scopes passed by a Google client library. Use 'scopes' for user-defined scopes. quota_project_id (Optional[str]): The project ID used for quota and billing. This project may be different from the project used to create the credentials. rapt_token (Optional[str]): The reauth Proof Token. refresh_handler (Optional[Callable[[google.auth.transport.Request, Sequence[str]], [str, datetime]]]): A callable which takes in the HTTP request callable and the list of OAuth scopes and when called returns an access token string for the requested scopes and its expiry datetime. This is useful when no refresh tokens are provided and tokens are obtained by calling some external process on demand. It is particularly useful for retrieving downscoped tokens from a token broker. enable_reauth_refresh (Optional[bool]): Whether reauth refresh flow should be used. This flag is for gcloud to use only. granted_scopes (Optional[Sequence[str]]): The scopes that were consented/granted by the user. This could be different from the requested scopes and it could be empty if granted and requested scopes were same. trust_boundary (str): String representation of trust boundary meta. universe_domain (Optional[str]): The universe domain. The default universe domain is googleapis.com. account (Optional[str]): The account associated with the credential. � N)�superr �__init__�token�expiry�_refresh_token� _id_token�_scopes�_default_scopes�_granted_scopes� _token_uri� _client_id�_client_secret�_quota_project_id�_rapt_token�refresh_handler�_enable_reauth_refresh�_trust_boundaryr �DEFAULT_UNIVERSE_DOMAIN�_universe_domain�_account)�selfr � refresh_token�id_token� token_uri� client_id� client_secret�scopes�default_scopes�quota_project_idr � rapt_tokenr �enable_reauth_refresh�granted_scopes�trust_boundary�universe_domain�account�� __class__� �L/usr/local/CyberCP/lib/python3.10/site-packages/google/oauth2/credentials.pyr G s$ AzCredentials.__init__c C s* | j �� }d|v r|d= d|v r|d= |S )z�A __getstate__ method must exist for the __setstate__ to be called This is identical to the default implementation. See https://docs.python.org/3.7/library/pickle.html#object.__setstate__ �_refresh_handler�_refresh_worker)�__dict__�copy)r � state_dictr0 r0 r1 �__getstate__� s zCredentials.__getstate__c C s� |� d�| _|� d�| _|� d�| _|� d�| _|� d�| _|� d�| _|� d�| _|� d�| _|� d �| _ |� d �| _ |� d�| _|� d�| _|� d �| _ |� d�| _|� d�p[tj| _d| _d| _|� dd�| _|� dd�| _dS )z\Credentials pickled with older versions of the class do not have all the attributes.r r r r r r r r r r r r r r r N�_use_non_blocking_refreshFr r )�getr r r r r r r r r r r r r r r r r r2 r3 r8 r )r �dr0 r0 r1 �__setstate__� s( �zCredentials.__setstate__c C � | j S )z+Optional[str]: The OAuth 2.0 refresh token.)r �r r0 r0 r1 r � � zCredentials.refresh_tokenc C r<