
    (ph                     n    S r SSKJr  SSKJr  SSKJr   " S S\5      r " S S\5      r " S	 S
\5      rg)z(Interfaces for asynchronous credentials.    )_helpers)
exceptions)_BaseCredentialsc                   B   ^  \ rS rSrSrU 4S jrSS jrS rS rSr	U =r
$ )	Credentials   a*  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                 *   > [         [        U ]  5         g N)superr   __init__)self	__class__s    N/var/www/html/venv/lib/python3.13/site-packages/google/auth/aio/credentials.pyr   Credentials.__init__+   s    k4)+    c                 *   #    U R                  XS9  g7f)zApply 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   s      r   applyCredentials.apply.   s      	G)s   c                     #    [        S5      e7f)zRefreshes 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.
zRefresh must be implemented)NotImplementedErrorr   requests     r   refreshCredentials.refresh8   s      ""?@@s   c                 B   #    U R                  U5      I Sh  vN   g N7f)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   s        r   before_requestCredentials.before_requestE   s      jj!!!    r
   )__name__
__module____qualname____firstlineno____doc__r   r   r   r%   __static_attributes____classcell__r   s   @r   r   r      s"    $,*A" "r   r   c                      ^  \ rS rSrSrU 4S jr\R                  " \5      S 5       r	\R                  " \5      S 5       r
SrU =r$ )StaticCredentialsV   a  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                 6   > [         [        U ]  5         Xl        g)z*
Args:
    token (str): The access token.
N)r   r2   r   r   )r   r   r   s     r   r   StaticCredentials.__init__c   s    
 	/1
r   c                 6   #    [         R                  " S5      e7f)Nz'Static credentials cannot be refreshed.r   InvalidOperationr   s     r   r   StaticCredentials.refreshk   s     ))*STT   c                 B   #    U R                  U5      I S h  vN   g  N7fr
   r!   r"   s        r   r%    StaticCredentials.before_requestq   s     jj!!!r'   r   )r)   r*   r+   r,   r-   r   r   copy_docstringr   r   r%   r.   r/   r0   s   @r   r2   r2   V   sM    
 [)U *U
 [)" *"r   r2   c                   .    \ rS rSrSrS rSS jrS rSrg)	AnonymousCredentialsv   zAsynchronous 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                 6   #    [         R                  " S5      e7f)zNRaises :class:``InvalidOperation``, anonymous credentials cannot be
refreshed.z*Anonymous credentials cannot be refreshed.r7   r   s     r   r   AnonymousCredentials.refresh}   s      ))*VWWr:   Nc                 >   #    Ub  [         R                  " S5      eg7f)zAnonymous credentials do nothing to the request.

The optional ``token`` argument is not supported.

Raises:
    google.auth.exceptions.InvalidValue: If a token was specified.
Nz+Anonymous credentials don't support tokens.)r   InvalidValuer   s      r   r   AnonymousCredentials.apply   s$      ))*WXX s   c                    #    g7f)z0Anonymous credentials do nothing to the request.Nr(   r"   s        r   r%   #AnonymousCredentials.before_request   s     s   r(   r
   )	r)   r*   r+   r,   r-   r   r   r%   r.   r(   r   r   r?   r?   v   s    X
	Yr   r?   N)	r-   google.authr   r   google.auth._credentials_baser   r   r2   r?   r(   r   r   <module>rJ      s<     / ! " :;"" ;"|" "@; r   