Ë
    ùmxi¦`  ã                   óJ  — d Z 	 ddlmZ ddlZddlZddlZddlZddl	m
Z
 ddlmZ ddlmZ ddlmZ ddlmZ  G d	„ d
ej"                  ¬«      Z G d„ de
«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Zdd„Z G d„ dej0                  «      Zy# e$ r	 ddlmZ Y Œ—w xY w)a=  Identity Pool Credentials.

This module provides credentials to access Google Cloud resources from on-prem
or non-Google Cloud platforms which support external credentials (e.g. OIDC ID
tokens) retrieved from local file locations or local servers. This includes
Microsoft Azure and OIDC identity providers (e.g. K8s workloads registered with
Hub with Hub workload identity enabled).

These credentials are recommended over the use of service account credentials
in on-prem/non-Google Cloud platforms as they do not involve the management of
long-live service account private keys.

Identity Pool Credentials are initialized using external_account
arguments which are typically loaded from an external credentials file or
an external credentials URL.

This module also provides a definition for an abstract subject token supplier.
This supplier can be implemented to return a valid OIDC or SAML2.0 subject token
and used to create Identity Pool credentials. The credentials will then call the
supplier instead of using pre-defined methods such as reading a local file or
calling a URL.
é    )ÚMappingN)Ú
NamedTuple)Ú_helpers)Ú
exceptions)Úexternal_account)Ú_mtls_helperc                   ó4   — e Zd ZdZej
                  d„ «       Zy)ÚSubjectTokenSupplieraW  Base class for subject token suppliers. This can be implemented with custom logic to retrieve
    a subject token to exchange for a Google Cloud access token when using Workload or
    Workforce Identity Federation. The identity pool credential does not cache the subject token,
    so caching logic should be added in the implementation.
    c                 ó   — t        d«      ‚)a×  Returns the requested subject token. The subject token must be valid.

        .. warning: This is not cached by the calling Google credential, so caching logic should be implemented in the supplier.

        Args:
            context (google.auth.externalaccount.SupplierContext): The context object
                containing information about the requested audience and subject token type.
            request (google.auth.transport.Request): The object used to make
                HTTP requests.

        Raises:
            google.auth.exceptions.RefreshError: If an error is encountered during
                subject token retrieval logic.

        Returns:
            str: The requested subject token string.
        Ú )ÚNotImplementedError)ÚselfÚcontextÚrequests      úP/home/htdocs/ttos/venv/lib/python3.12/site-packages/google/auth/identity_pool.pyÚget_subject_tokenz&SubjectTokenSupplier.get_subject_token>   s   € ô& " "Ó%Ð%ó    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚabcÚabstractmethodr   © r   r   r
   r
   7   s!   „ ñð 	×Ññ&ó ñ&r   r
   )Ú	metaclassc                   ó&   — e Zd ZU dZeed<   eed<   y)Ú_TokenContenta  Models the token content response from file and url internal suppliers.
    Attributes:
        content (str): The string content of the file or URL response.
        location (str): The location the content was retrieved from. This will either be a file location or a URL.
    ÚcontentÚlocationN)r   r   r   r   ÚstrÚ__annotations__r   r   r   r   r   T   s   … ñð ƒLØ„Mr   r   c                   óF   — e Zd ZdZd„ Z ej                  e«      d„ «       Zy)Ú_FileSupplierzeInternal implementation of subject token supplier which supports reading a subject token from a file.c                 ó.   — || _         || _        || _        y ©N)Ú_pathÚ_format_typeÚ_subject_token_field_name)r   ÚpathÚformat_typeÚsubject_token_field_names       r   Ú__init__z_FileSupplier.__init__b   s   € ØˆŒ
Ø'ˆÔØ)AˆÕ&r   c                 ó”  — t         j                  j                  | j                  «      s.t	        j
                  dj                  | j                  «      «      ‚t        | j                  dd¬«      5 }t        |j                  «       | j                  «      }d d d «       t        | j                  | j                  «      S # 1 sw Y   Œ*xY w)NzFile '{}' was not found.Úrúutf-8)Úencoding)Úosr)   Úexistsr&   r   ÚRefreshErrorÚformatÚopenr   ÚreadÚ_parse_token_datar'   r(   )r   r   r   Úfile_objÚtoken_contents        r   r   z_FileSupplier.get_subject_tokeng   sš   € ä�w‰w�~‰~˜dŸj™jÔ)Ü×)Ñ)Ð*D×*KÑ*KÈDÏJÉJÓ*WÓXÐXä�$—*‘*˜c¨GÔ4ð 	G¸Ü)¨(¯-©-«/¸4¿:¹:ÓFˆM÷	Gô !Ø˜4×,Ñ,¨d×.LÑ.Ló
ð 	
÷	Gð 	Gús   Á0%B>Â>CN©	r   r   r   r   r,   r   Úcopy_docstringr
   r   r   r   r   r#   r#   _   s-   „ ÙoòBð
 €X×ÑÐ1Ó2ñ	
ó 3ñ	
r   r#   c                   óF   — e Zd ZdZd„ Z ej                  e«      d„ «       Zy)Ú_UrlSupplierzvInternal implementation of subject token supplier which supports retrieving a subject token by calling a URL endpoint.c                 ó<   — || _         || _        || _        || _        y r%   )Ú_urlr'   r(   Ú_headers)r   Úurlr*   r+   Úheaderss        r   r,   z_UrlSupplier.__init__w   s    € ØˆŒ	Ø'ˆÔØ)AˆÔ&Øˆ�r   c                 ór  —  || j                   d| j                  ¬«      }t        |j                  d«      r|j                  j	                  d«      n|j                  }|j
                  dk7  rt        j                  d|«      ‚t        || j                   «      }t        || j                  | j                  «      S )NÚGET)rA   ÚmethodrB   Údecoder/   éÈ   z.Unable to retrieve Identity Pool subject token)r?   r@   ÚhasattrÚdatarF   Ústatusr   r3   r   r7   r'   r(   )r   r   r   ÚresponseÚresponse_bodyr9   s         r   r   z_UrlSupplier.get_subject_token}   s    € á˜tŸy™y°ÀÇÁÔNˆô
 �x—}‘} hÔ/ð �M‰M× Ñ  Ô)à—‘ð 	ð �?‰?˜cÒ!Ü×)Ñ)Ø@À-óð ô & m°T·Y±YÓ?ˆÜ Ø˜4×,Ñ,¨d×.LÑ.Ló
ð 	
r   Nr:   r   r   r   r=   r=   t   s/   „ ñ Aò ð €X×ÑÐ1Ó2ñ
ó 3ñ
r   r=   c                   óR   — e Zd ZdZd„ Z ej                  e«      d„ «       Zd„ Z	d„ Z
y)Ú_X509Supplierz‡Internal supplier for X509 workload credentials. This class is used internally and always returns an empty string as the subject token.c                 ó    — || _         || _        y r%   )Ú_trust_chain_pathÚ_leaf_cert_callback)r   Útrust_chain_pathÚleaf_cert_callbacks      r   r,   z_X509Supplier.__init__•   s   € Ø!1ˆÔØ#5ˆÕ r   c                 ód  — ddl m} |j                  |j                  | j	                  «       «      }| j                  «       }g }|j                  t        j                  |«      «       |�t        |«      dk(  rt        j                  |«      S t        j                  |d   «      }||d   k7  r|j                  |«       t        dt        |«      «      D ]H  }t        j                  ||   «      }	|	|d   k(  rt        j                  d«      ‚|j                  |	«       ŒJ t        j                  |«      S )Nr   ©Úcryptoé   z?The leaf certificate must be at the top of the trust chain file)ÚOpenSSLrV   Úload_certificateÚFILETYPE_PEMrQ   Ú_read_trust_chainÚappendrN   Ú_encode_certÚlenÚjsonÚdumpsÚranger   r3   )
r   r   r   rV   Ú	leaf_certÚtrust_chainÚ
cert_chainÚ
first_certÚiÚencodeds
             r   r   z_X509Supplier.get_subject_token™   s  € õ 	#à×+Ñ+Ø×Ñ ×!9Ñ!9Ó!;ó
ˆ	ð ×,Ñ,Ó.ˆØˆ
à×Ñœ-×4Ñ4°YÓ?Ô@àÐ¤# kÓ"2°aÒ"7Ü—:‘:˜jÓ)Ð)ô #×/Ñ/°¸A±Ó?ˆ
Ø˜ A™Ò&Ø×Ñ˜jÔ)ä�qœ#˜kÓ*Ó+ò 	+ˆAÜ#×0Ñ0°¸Q±Ó@ˆGà˜* Q™-Ò'Ü ×-Ñ-ØUóð ð ×!Ñ! 'Õ*ð	+ô �z‰z˜*Ó%Ð%r   c                 óx  — ddl m} g }| j                  �| j                  dk(  r|S 	 t        | j                  d«      5 }|j	                  «       }|j                  d«      }|D ]F  }|j                  «       sŒd|z   }	 |j                  |j                  |«      }|j                  |«       ŒH |cd d d «       S # t        $ r4}	t        j                  dj                  | j                  «      «      |	‚d }	~	ww xY w# 1 sw Y   y xY w# t        $ r/ t        j                  dj                  | j                  «      «      ‚w xY w)Nr   rU   r   Úrbs   -----BEGIN CERTIFICATE-----z=Error loading PEM certificates from the trust chain file '{}'z$Trust chain file '{}' was not found.)rX   rV   rP   r5   r6   ÚsplitÚstriprY   rZ   r\   Ú	Exceptionr   r3   r4   ÚFileNotFoundError)
r   rV   Úcertificate_trust_chainÚfÚtrust_chain_dataÚcert_blocksÚ
cert_blockÚ	cert_dataÚcertÚes
             r   r[   z_X509Supplier._read_trust_chainº   sL  € õ 	#à"$Ðà×!Ñ!Ð)¨T×-CÑ-CÀrÒ-IØ*Ð*ð	ä�d×,Ñ,¨dÓ3ð /°qØ#$§6¡6£8Ð à.×4Ñ4Ð5SÓT�Ø"-ò %�Jà!×'Ñ'Õ)Ø$BÀZÑ$O˜	ð%à#)×#:Ñ#:Ø &× 3Ñ 3°Yó$˜Dð 4×:Ñ:¸4Õ@ð%ð  /÷)/ñ /øô  )ò %Ü",×"9Ñ"9Ø _× fÑ fØ$(×$:Ñ$:ó!"ó#ð $%ð	%ûð%ú÷/ð /ûô* !ò 	Ü×)Ñ)Ø6×=Ñ=¸d×>TÑ>TÓUóð ð	úsR   §D ½7C5Á5C5Á;-B5Â(C5Â+	D Â5	C2Â>/C-Ã-C2Ã2C5Ã5C>Ã:D Ã>D Ä8D9c                 óŠ   — ddl m} t        j                  |j	                  |j
                  | «      «      j                  d«      S )Nr   rU   r/   )rX   rV   Úbase64Ú	b64encodeÚdump_certificateÚFILETYPE_ASN1rF   )rt   rV   s     r   r]   z_X509Supplier._encode_certß   s9   € õ 	#ä×ÑØ×#Ñ# F×$8Ñ$8¸$Ó?ó
ç
‰&�‹/ð	r   N)r   r   r   r   r,   r   r;   r
   r   r[   r]   r   r   r   rN   rN   ’   s;   „ ñ Rò6ð €X×ÑÐ1Ó2ñ&ó 3ð&ò@#óJr   rN   c                 ó&  — |dk(  r| j                   }n%	 t        j                  | j                   «      }||   }|st        j                  d«      ‚|S # t        t        f$ r0 t        j                  dj                  | j                  |«      «      ‚w xY w)NÚtextz@Unable to parse subject_token from JSON file '{}' using key '{}'z3Missing subject_token in the credential_source file)	r   r_   ÚloadsÚKeyErrorÚ
ValueErrorr   r3   r4   r   )r9   r*   r+   ÚtokenÚresponse_datas        r   r7   r7   é   sž   € Ø�fÒØ×%Ñ%‰ð
	ä ŸJ™J }×'<Ñ'<Ó=ˆMà!Ð":Ñ;ˆEñ Ü×%Ñ%ØAó
ð 	
ð €Løô œ*Ð%ò 	Ü×)Ñ)ØR×YÑYØ!×*Ñ*Ð,Dóóð ð	ús   ”$A Á?Bc                   óî   ‡ — e Zd ZdZej
                  ddfˆ fd„	Z ej                  ej                  «      d„ «       Z
d„ Zd„ Zd„ Zˆ fd„Zd	„ Zˆ fd
„Zd„ Zd„ Zd„ Zeˆ fd„«       Zeˆ fd„«       Zd„ Zˆ xZS )ÚCredentialsaÞ  External account credentials sourced from files and URLs.

    **IMPORTANT**:
    This class does not validate the credential configuration. A security
    risk occurs when a credential configuration configured with malicious urls
    is used.
    When the credential configuration is accepted from an
    untrusted source, you should validate it before using.
    Refer https://cloud.google.com/docs/authentication/external/externally-sourced-credentials for more details.
    Nc                 ó¶  •— t        t        | �
  |||||dœ|¤Ž |€|€t        j                  d«      ‚|�|�t        j                  d«      ‚|�|| _        d| _        d| _        d| _        yt        |t        «      sd| _        t        j                  d«      ‚|j                  d«      | _        |j                  d«      | _        |j                  d«      | _        d	|v rt        j                  d
«      ‚| j                  «        | j                  r| j                  «        n| j!                  |«       | j                  r1t#        | j                  | j$                  | j&                  «      | _        y| j                  r<t)        | j                  | j$                  | j&                  | j*                  «      | _        yt-        | j.                  | j0                  «      | _        y)uÁ	  Instantiates an external account credentials object from a file/URL.

        Args:
            audience (str): The STS audience field.
            subject_token_type (str): The subject token type based on the Oauth2.0 token exchange spec.
                Expected values include::

                    â€œurn:ietf:params:oauth:token-type:jwtâ€�
                    â€œurn:ietf:params:oauth:token-type:id-tokenâ€�
                    â€œurn:ietf:params:oauth:token-type:saml2â€�

            token_url (Optional [str]): The STS endpoint URL. If not provided, will default to "https://sts.googleapis.com/v1/token".
            credential_source (Optional [Mapping]): The credential source dictionary used to
                provide instructions on how to retrieve external credential to be
                exchanged for Google access tokens. Either a credential source or
                a subject token supplier must be provided.

                Example credential_source for url-sourced credential::

                    {
                        "url": "http://www.example.com",
                        "format": {
                            "type": "json",
                            "subject_token_field_name": "access_token",
                        },
                        "headers": {"foo": "bar"},
                    }

                Example credential_source for file-sourced credential::

                    {
                        "file": "/path/to/token/file.txt"
                    }
            subject_token_supplier (Optional [SubjectTokenSupplier]): Optional subject token supplier.
                This will be called to supply a valid subject token which will then
                be exchanged for Google access tokens. Either a subject token  supplier
                or a credential source must be provided.
            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.
            ValueError: 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.
        )ÚaudienceÚsubject_token_typeÚ	token_urlÚcredential_sourceNzGA valid credential source or a subject token supplier must be provided.z[Identity pool credential cannot have both a credential source and a subject token supplier.z?Invalid credential_source. The credential_source is not a dict.ÚfilerA   ÚcertificateÚenvironment_idz>Invalid Identity Pool credential_source field 'environment_id')Úsuperrƒ   r,   r   ÚInvalidValueÚ_subject_token_supplierÚ_credential_source_fileÚ_credential_source_urlÚ_credential_source_certificateÚ
isinstancer   Ú_credential_source_executableÚMalformedErrorÚgetÚ_validate_single_sourceÚ_validate_certificate_configÚ_validate_file_or_url_configr#   Ú_credential_source_format_typeÚ_credential_source_field_namer=   Ú_credential_source_headersrN   rP   Ú_get_cert_bytes)	r   r…   r†   r‡   rˆ   Úsubject_token_supplierÚargsÚkwargsÚ	__class__s	           €r   r,   zCredentials.__init__  sæ  ø€ ôx 	Œk˜4Ñ)ð
 ð	 Ø1ØØ/ñ		
ð ò	
ð Ð$Ð)?Ð)GÜ×)Ñ)ØYóð ð Ð(Ð-CÐ-OÜ×)Ñ)Ømóð ð "Ð-Ø+AˆDÔ(Ø+/ˆDÔ(Ø*.ˆDÔ'Ø26ˆDÕ/äÐ/´Ô9Ø59�Ô2Ü ×/Ñ/ØUóð ð ,=×+@Ñ+@ÀÓ+HˆDÔ(Ø*;×*?Ñ*?ÀÓ*FˆDÔ'Ø2C×2GÑ2GÈÓ2VˆDÔ/ð  Ð#4Ñ4Ü ×/Ñ/ØTóð ð
 ×(Ñ(Ô*à×2Ò2Ø×1Ñ1Õ3à×1Ñ1Ð2CÔDà×+Ò+Ü/<Ø×0Ñ0Ø×7Ñ7Ø×6Ñ6ó0�Õ,ð
 ×,Ò,Ü/;Ø×/Ñ/Ø×7Ñ7Ø×6Ñ6Ø×3Ñ3ó	0�Õ,ô 0=Ø×*Ñ*¨D×,@Ñ,@ó0�Õ,r   c                 óN   — | j                   j                  | j                  |«      S r%   )rŽ   r   Ú_supplier_context)r   r   s     r   Úretrieve_subject_tokenz"Credentials.retrieve_subject_tokenˆ  s&   € à×+Ñ+×=Ñ=Ø×"Ñ" Gó
ð 	
r   c                 ó‚   — | j                   €t        j                  d«      ‚t        j                  | j
                  «      S )Nz†The credential is not configured to use mtls requests. The credential should include a "certificate" section in the credential source.)r‘   r   r3   r   Ú _get_workload_cert_and_key_pathsÚ_certificate_config_location©r   s    r   Ú_get_mtls_cert_and_key_pathsz(Credentials._get_mtls_cert_and_key_pathsŽ  sE   € Ø×.Ñ.Ð6Ü×)Ñ)ð Yóð ô  ×@Ñ@Ø×1Ñ1óð r   c                 óR   — | j                  «       \  }}t        j                  |«      S r%   )r¨   r   Ú_read_cert_file)r   Ú	cert_pathÚ_s      r   rœ   zCredentials._get_cert_bytes˜  s%   € Ø×8Ñ8Ó:‰ˆ	�1Ü×+Ñ+¨IÓ6Ð6r   c                 ó   — | j                   d uS r%   )r‘   r§   s    r   Ú_mtls_requiredzCredentials._mtls_requiredœ  s   € Ø×2Ñ2¸$Ð>Ð>r   c                 ó   •— t         t        | �  «       }t        | j                  t
        «      rK| j                  j                  d«      rd|d<   |S | j                  j                  d«      rd|d<   |S d|d<   |S d|d<   |S )Nr‰   ÚsourcerA   Úx509Úprogrammatic)rŒ   rƒ   Ú_create_default_metrics_optionsr’   Ú_credential_sourcer   r•   )r   Úmetrics_optionsr    s     €r   r³   z+Credentials._create_default_metrics_optionsŸ  s˜   ø€ Ü¤¨TÑRÓTˆô �d×-Ñ-¬wÔ7Ø×&Ñ&×*Ñ*¨6Ô2Ø,2� Ñ)ð Ðð ×(Ñ(×,Ñ,¨UÔ3Ø,1� Ñ)ð
 Ðð -3� Ñ)ð Ðð )7ˆO˜HÑ%ØÐr   c                 ó   — | j                   d u S r%   )r´   r§   s    r   Ú_has_custom_supplierz Credentials._has_custom_supplier¯  s   € Ø×&Ñ&¨$Ð.Ð.r   c                 ó†   •— t         t        | �  «       }| j                  «       r|j	                  d| j
                  i«       |S )Nr�   )rŒ   rƒ   Ú_constructor_argsr·   ÚupdaterŽ   )r   rž   r    s     €r   r¹   zCredentials._constructor_args²  s;   ø€ Ü”[ $Ñ9Ó;ˆà×$Ñ$Ô&Ø�K‰KÐ1°4×3OÑ3OÐPÔQØˆr   c                 óH  — | j                   j                  d«      | _        | j                   j                  d«      }| j                   j                  d«      | _        | j                  r|rt	        j
                  d«      ‚| j                  s|st	        j
                  d«      ‚y y )NÚcertificate_config_locationÚuse_default_certificate_configrR   z~Invalid certificate configuration, certificate_config_location cannot be specified when use_default_certificate_config = true.zInvalid certificate configuration, use_default_certificate_config should be true if no certificate_config_location is provided.)r‘   r•   r¦   rP   r   r”   )r   Úuse_defaults     r   r—   z(Credentials._validate_certificate_config¹  s¬   € Ø,0×,OÑ,O×,SÑ,SØ)ó-
ˆÔ)ð ×9Ñ9×=Ñ=Ø,ó
ˆð "&×!DÑ!D×!HÑ!HØó"
ˆÔð ×,Ò,±Ü×+Ñ+ð Qóð ð ×0Ò0¹Ü×+Ñ+ð Róð ð :EÐ0r   c                 óœ  — |j                  d«      | _        |j                  di «      }|j                  d«      xs d| _        | j                  dvr.t        j                  dj                  | j                  «      «      ‚| j                  dk(  r8|j                  d«      | _        | j                  €t        j                  d	«      ‚y d | _        y )
NrB   r4   Útyper|   )r|   r_   z%Invalid credential_source format '{}'r_   r+   zBMissing subject_token_field_name for JSON credential_source format)r•   r›   r™   r   r”   r4   rš   )r   rˆ   Úcredential_source_formats      r   r˜   z(Credentials._validate_file_or_url_configÌ  sÙ   € Ø*;×*?Ñ*?À	Ó*JˆÔ'Ø#4×#8Ñ#8¸À2Ó#FÐ ð %×(Ñ(¨Ó0Ò:°Fð 	Ô+ð ×.Ñ.Ð6FÑFÜ×+Ñ+Ø7×>Ñ>Ø×7Ñ7óóð ð ×.Ñ.°&Ò8Ø1I×1MÑ1MØ*ó2ˆDÔ.ð ×1Ñ1Ð9Ü ×/Ñ/ØXóð ð :ð
 26ˆDÕ.r   c                 ó  — | j                   | j                  | j                  g}t        t	        d„ |«      «      }t        |«      dkD  rt        j                  d«      ‚t        |«      dk7  rt        j                  d«      ‚y )Nc                 ó
   — | d uS r%   r   )r°   s    r   ú<lambda>z5Credentials._validate_single_source.<locals>.<lambda>í  s   €  &°Ð"4€ r   rW   zVAmbiguous credential_source. 'file', 'url', and 'certificate' are mutually exclusive..zNMissing credential_source. A 'file', 'url', or 'certificate' must be provided.)r�   r�   r‘   ÚlistÚfilterr^   r   r”   )r   Úcredential_sourcesÚvalid_credential_sourcess      r   r–   z#Credentials._validate_single_sourceæ  s�   € à×(Ñ(Ø×'Ñ'Ø×/Ñ/ð
Ðô
 $(ÜÑ4Ð6HÓIó$
Ð ô Ð'Ó(¨1Ò,Ü×+Ñ+Øhóð ô Ð'Ó(¨AÒ-Ü×+Ñ+Ø`óð ð .r   c                 ót   •— |j                  d«      }|j                  d|i«       t        t        | �  |fi |¤ŽS )až  Creates an Identity Pool Credentials instance from parsed external account info.

        **IMPORTANT**:
        This method does not validate the credential configuration. A security
        risk occurs when a credential configuration configured with malicious urls
        is used.
        When the credential configuration is accepted from an
        untrusted source, you should validate it before using with this method.
        Refer https://cloud.google.com/docs/authentication/external/externally-sourced-credentials for more details.

        Args:
            info (Mapping[str, str]): The Identity Pool external account info in Google
                format.
            kwargs: Additional arguments to pass to the constructor.

        Returns:
            google.auth.identity_pool.Credentials: The constructed
                credentials.

        Raises:
            ValueError: For invalid parameters.
        r�   )r•   rº   rŒ   rƒ   Ú	from_info)ÚclsÚinforŸ   r�   r    s       €r   rÊ   zCredentials.from_infoù  s?   ø€ ð0 "&§¡Ð*BÓ!CÐØ�‰Ð/Ð1GÐHÔIÜ”[ #Ñ0°Ñ@¸Ñ@Ð@r   c                 ó,   •— t        t        | �
  |fi |¤ŽS )aB  Creates an IdentityPool Credentials instance from an external account json file.

        **IMPORTANT**:
        This method does not validate the credential configuration. A security
        risk occurs when a credential configuration configured with malicious urls
        is used.
        When the credential configuration is accepted from an
        untrusted source, you should validate it before using with this method.
        Refer https://cloud.google.com/docs/authentication/external/externally-sourced-credentials for more details.

        Args:
            filename (str): The path to the IdentityPool external account json file.
            kwargs: Additional arguments to pass to the constructor.

        Returns:
            google.auth.identity_pool.Credentials: The constructed
                credentials.
        )rŒ   rƒ   Ú	from_file)rË   ÚfilenamerŸ   r    s      €r   rÎ   zCredentials.from_file  s   ø€ ô( ”[ #Ñ0°ÑD¸VÑDÐDr   c                 óú   — ddl m} d}| j                  �C| j                  «       }|j	                  |«      }|j                  |«      r|j                  |«      }| j                  ||¬«       | j                  |«       y)zŸRefreshes the access token.

        Args:
            request (google.auth.transport.Request): The object used to make
                HTTP requests.
        r   )Ú_agent_identity_utilsN)Úcert_fingerprint)	Úgoogle.authrÑ   r‘   rœ   Úparse_certificateÚshould_request_bound_tokenÚ!calculate_certificate_fingerprintÚ_perform_refresh_tokenÚ_handle_trust_boundary)r   r   rÑ   rÒ   Ú
cert_bytesrt   s         r   ÚrefreshzCredentials.refresh+  s|   € õ 	6àÐà×.Ñ.Ð:Ø×-Ñ-Ó/ˆJØ(×:Ñ:¸:ÓFˆDØ$×?Ñ?ÀÔEà)×KÑKÈDÓQð !ð 	×#Ñ# GÐ>NÐ#ÔOØ×#Ñ# GÕ,r   )r   r   r   r   r   Ú_DEFAULT_TOKEN_URLr,   r   r;   rƒ   r£   r¨   rœ   r®   r³   r·   r¹   r—   r˜   r–   ÚclassmethodrÊ   rÎ   rÚ   Ú__classcell__)r    s   @r   rƒ   rƒ   ÿ   s¦   ø„ ñ	ð #×5Ñ5ØØ#õ{ðz €X×ÑÐ-×9Ñ9Ó:ñ
ó ;ð
ò
ò7ò?ôò /ôòò&6ò4ð& óAó ðAð6 óEó ðEö*-r   rƒ   )r|   N)r   Úcollections.abcr   ÚImportErrorÚcollectionsr   rw   r_   r1   Útypingr   rÓ   r   r   r   Úgoogle.auth.transportr   ÚABCMetar
   r   r#   r=   rN   r7   rƒ   r   r   r   ú<module>rä      s¤   ðñð.$Ý'ó Û Û Û 	Ý å  Ý "Ý (Ý .ô& S§[¡[õ &ô:�Jô ô
Ð(ô 
ô*
Ð'ô 
ô<TÐ(ô Tónô,@-Ð"×.Ñ.õ @-øðm ò $ß#ð$ús   „B ÂB"Â!B"