�
J�gI � � � d Z ddlZddlmZ ddlZddlmZmZ ddlmZ ddlm Z ddl
mZ ddlm
Z
d Z G d
� de� � Z G d� d
e� � Z G d� de� � Z G d� de� � Z G d� de� � Z G d� dej �� � Z G d� de� � Zdd�Z G d� dej �� � Z G d� de� � ZdS )zInterfaces for credentials.� N)�Enum)�_helpers�environment_vars)�
exceptions)�metrics)�_BaseCredentials)�RefreshThreadManagerzgoogleapis.comc �� � � e Zd ZdZ� fd�Zed� � � Zed� � � Zed� � � Zed� � � Z ed� � � Z
d� Zej
d � � � Zd
� Zdd�Zd
� Zd� Zd� Zd� Z� xZS )�CredentialsaQ Base class for all 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 �� �� t t | � � � � � d | _ d | _ d | _ t | _ d| _ t � � | _
d S �NF)�superr �__init__�expiry�_quota_project_id�_trust_boundary�DEFAULT_UNIVERSE_DOMAIN�_universe_domain�_use_non_blocking_refreshr �_refresh_worker��self� __class__s ��g/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/google/auth/credentials.pyr zCredentials.__init__2 sq �� �
�k�4� � �)�)�+�+�+���� B�!%���K�#��� � !8��� � */��&�3�5�5����� c �j � | j sdS | j t j z
}t j � � |k S )a( Checks if the credentials are expired.
Note that credentials can be invalid but not expired because
Credentials with :attr:`expiry` set to None is considered to never
expire.
.. deprecated:: v2.24.0
Prefer checking :attr:`token_state` instead.
F)r r �REFRESH_THRESHOLD�utcnow)r �
skewed_expirys r �expiredzCredentials.expiredE s7 � � �{� ��5� ��h�&@�@�
��� � �M�1�1r c �$ � | j duo| j S )z�Checks the validity of the credentials.
This is True if the credentials have a :attr:`token` and the token
is not :attr:`expired`.
.. deprecated:: v2.24.0
Prefer checking :attr:`token_state` instead.
N)�tokenr �r s r �validzCredentials.validW s � � �z��%�:�d�l�*:�:r c �( � | j �t j S | j �t j S t j � � | j k }|rt j S t j � � | j t
j z
k }|rt j S t j S )z(
See `:obj:`TokenState`
) r"