File manager - Edit - /usr/local/CyberCP/lib/python3.10/site-packages/google/auth/__pycache__/pluggable.cpython-310.pyc
Back
o �h�C � @ s� d Z zddlmZ W n ey ddlmZ Y nw ddlZddlZddlZddlZddl Z ddl mZ ddl mZ ddl m Z dZdZd Zd ZdZdZG dd � d e j�ZdS )a� Pluggable Credentials. Pluggable Credentials are initialized using external_account arguments which are typically loaded from third-party executables. Unlike other credentials that can be initialized with a list of explicit arguments, secrets or credentials, external account clients use the environment and hints/guidelines provided by the external_account JSON file to retrieve credentials and exchange them for Google access tokens. Example credential_source for pluggable credential: { "executable": { "command": "/path/to/get/credentials.sh --arg1=value1 --arg2=value2", "timeout_millis": 5000, "output_file": "/path/to/generated/cached/credentials" } } � )�MappingN)�_helpers)� exceptions)�external_account� i0u i� i�� i@w c s� e Zd ZdZ� fdd�Ze�ej�dd� �Z dd� Z edd � �Ze � fd d��Ze � fdd ��Zdd� Zdd� Zdd� Zdd� Zdd� Z� fdd�Z� ZS )�Credentialsz6External account credentials sourced from executables.c s |� dd�| _tt| �j|||||d�|�� t|t�s$d| _t� d��|� d�| _| js2t� d��| j� d�| _| j� d �| _| j� d �| _ | j� d�| _d| _| jsYt� d ��| js`t| _n| jtk sj| jtkrot�d��| j r�| j tk s|| j tkr�t�d��dS dS )ad Instantiates an external account credentials object from a executables. Args: audience (str): The STS audience field. subject_token_type (str): The subject token type. token_url (str): The STS endpoint URL. credential_source (Mapping): The credential source dictionary used to provide instructions on how to retrieve external credential to be exchanged for Google access tokens. Example credential_source for pluggable credential: { "executable": { "command": "/path/to/get/credentials.sh --arg1=value1 --arg2=value2", "timeout_millis": 5000, "output_file": "/path/to/generated/cached/credentials" } } args (List): Optional positional arguments passed into the underlying :meth:`~external_account.Credentials.__init__` method. kwargs (Mapping): Optional keyword arguments passed into the underlying :meth:`~external_account.Credentials.__init__` method. Raises: google.auth.exceptions.RefreshError: If an error is encountered during access token retrieval logic. google.auth.exceptions.InvalidValue: For invalid parameters. google.auth.exceptions.MalformedError: For invalid parameters. .. note:: Typically one of the helper constructors :meth:`from_file` or :meth:`from_info` are used instead of calling the constructor directly. �interactiveF)�audience�subject_token_type� token_url�credential_sourceNz?Missing credential_source. The credential_source is not a dict.� executablez<Missing credential_source. An 'executable' must be provided.�command�timeout_millis�interactive_timeout_millis�output_file� z;Missing command field. Executable command must be provided.z*Timeout must be between 5 and 120 seconds.z>Interactive timeout must be between 30 seconds and 30 minutes.)�popr �superr �__init__� isinstancer �_credential_source_executabler �MalformedError�get�%_credential_source_executable_command�,_credential_source_executable_timeout_millis�8_credential_source_executable_interactive_timeout_millis�)_credential_source_executable_output_file�_tokeninfo_username�!EXECUTABLE_TIMEOUT_MILLIS_DEFAULT�%EXECUTABLE_TIMEOUT_MILLIS_LOWER_BOUND�%EXECUTABLE_TIMEOUT_MILLIS_UPPER_BOUND�InvalidValue�1EXECUTABLE_INTERACTIVE_TIMEOUT_MILLIS_LOWER_BOUND�1EXECUTABLE_INTERACTIVE_TIMEOUT_MILLIS_UPPER_BOUND)�selfr r r r �args�kwargs�� __class__� �H/usr/local/CyberCP/lib/python3.10/site-packages/google/auth/pluggable.pyr >