|
Server : LiteSpeed System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64 User : nandedex ( 1060) PHP Version : 8.1.33 Disable Function : NONE Directory : /opt/cppython/lib/python3.8/site-packages/google/auth/aio/__pycache__/ |
U
O��g� � @ s\ d Z ddlmZ ddlmZ ddlmZ G dd� de�ZG dd� de�ZG d d
� d
e�ZdS )z(Interfaces for asynchronous credentials.� )�_helpers)�
exceptions)�_BaseCredentialsc s: e Zd ZdZ� fdd�Zddd�Zdd� Zd d
� Z� ZS )�Credentialsa^ Base class for all asynchronous credentials.
All credentials have a :attr:`token` that is used for authentication and
may also optionally set an :attr:`expiry` to indicate when the token will
no longer be valid.
Most credentials will be :attr:`invalid` until :meth:`refresh` is called.
Credentials can do this automatically before the first HTTP request in
:meth:`before_request`.
Although the token and expiration will change as the credentials are
:meth:`refreshed <refresh>` and used, credentials should be considered
immutable. Various credentials will accept configuration such as private
keys, scopes, and other options. These options are not changeable after
construction. Some classes will provide mechanisms to copy the credentials
with modifications such as :meth:`ScopedCredentials.with_scopes`.
c s t t| ��� d S �N)�superr �__init__)�self�� __class__� �H/opt/cppython/lib/python3.8/site-packages/google/auth/aio/credentials.pyr + s zCredentials.__init__Nc � s | j ||d� dS )z�Apply the token to the authentication header.
Args:
headers (Mapping): The HTTP request headers.
token (Optional[str]): If specified, overrides the current access
token.
)�tokenN)�_apply�r �headersr r r r
�apply. s zCredentials.applyc � s t d��dS )a Refreshes the access token.
Args:
request (google.auth.aio.transport.Request): The object used to make
HTTP requests.
Raises:
google.auth.exceptions.RefreshError: If the credentials could
not be refreshed.
zRefresh must be implementedN)�NotImplementedError�r �requestr r r
�refresh8 s zCredentials.refreshc � s | � |�I dH dS )a Performs credential-specific before request logic.
Refreshes the credentials if necessary, then calls :meth:`apply` to
apply the token to the authentication header.
Args:
request (google.auth.aio.transport.Request): The object used to make
HTTP requests.
method (str): The request's HTTP method or the RPC method being
invoked.
url (str): The request's URI or the RPC service's URI.
headers (Mapping): The request's headers.
N�r �r r �method�urlr r r r
�before_requestE s zCredentials.before_request)N) �__name__�
__module__�__qualname__�__doc__r r r r �
__classcell__r r r
r
r s
r c sD e Zd ZdZ� fdd�Ze�e�dd� �Ze�e�dd� �Z � Z
S )�StaticCredentialsa� Asynchronous Credentials representing an immutable access token.
The credentials are considered immutable except the tokens which can be
configured in the constructor ::
credentials = StaticCredentials(token="token123")
StaticCredentials does not support :meth `refresh` and assumes that the configured
token is valid and not expired. StaticCredentials will never attempt to
refresh the token.
c s t t| ��� || _dS )zB
Args:
token (str): The access token.
N)r r! r r )r r r
r r
r c s zStaticCredentials.__init__c � s t �d��d S )Nz'Static credentials cannot be refreshed.�r �InvalidOperationr r r r
r k s zStaticCredentials.refreshc � s | � |�I d H d S r r r r r r
r q s z StaticCredentials.before_request)r r r r r r Zcopy_docstringr r r r r r r
r
r! V s
r! c @ s* e Zd ZdZdd� Zd dd�Zdd� ZdS )
�AnonymousCredentialsz�Asynchronous Credentials that do not provide any authentication information.
These are useful in the case of services that support anonymous access or
local service emulators that do not use credentials.
c � s t �d��dS )zVRaises :class:``InvalidOperation``, anonymous credentials cannot be
refreshed.z*Anonymous credentials cannot be refreshed.Nr"