§
    BP„j#n  ã                   ó¾   — d Z ddlZddl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ZdZd	Z G d
„ dej        ¦  «        Zd„ Z G d„ de¦  «        ZdS )z/oauth2client Service account credentials class.é    N)Ú_helpers)Úclient)Úcrypt)Ú	transportÚ
notasecretÚ_private_key_pkcs12a
  
This library only implements PKCS#12 support via the pyOpenSSL library.
Either install pyOpenSSL, or please convert the .p12 file
to .pem format:
    $ cat key.p12 | \
    >   openssl pkcs12 -nodes -nocerts -passin pass:notasecret | \
    >   openssl rsa > key.pem
c                   óê  ‡ — e Zd ZdZdZ	  edg¦  «        ej        j        z  Z	 dZ	dZ
dZddddej        ej        fˆ fd„	Zdˆ fd„	Ze	 dd„¦   «         Ze	 	 dd	„¦   «         Ze	 	 dd
„¦   «         Zeddej        ej        fd„¦   «         Zeddej        ej        fd„¦   «         Zeddej        ej        fd„¦   «         Zd„ Zd„ Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Zd„ Zd„ Zd„ Z d„ Z!ˆ xZ"S )ÚServiceAccountCredentialsaÅ  Service Account credential for OAuth 2.0 signed JWT grants.

    Supports

    * JSON keyfile (typically contains a PKCS8 key stored as
      PEM text)
    * ``.p12`` key (stores PKCS12 key and certificate)

    Makes an assertion to server using a signed JWT assertion in exchange
    for an access token.

    This credential does not require a flow to instantiate because it
    represents a two legged flow, and therefore has all of the required
    information to generate and refresh its own access tokens.

    Args:
        service_account_email: string, The email associated with the
                               service account.
        signer: ``crypt.Signer``, A signer which can be used to sign content.
        scopes: List or string, (Optional) Scopes to use when acquiring
                an access token.
        private_key_id: string, (Optional) Private key identifier. Typically
                        only used with a JSON keyfile. Can be sent in the
                        header of a JWT token assertion.
        client_id: string, (Optional) Client ID for the project that owns the
                   service account.
        user_agent: string, (Optional) User agent to use when sending
                    request.
        token_uri: string, URI for token endpoint. For convenience defaults
                   to Google's endpoints but any OAuth 2.0 provider can be
                   used.
        revoke_uri: string, URI for revoke endpoint.  For convenience defaults
                   to Google's endpoints but any OAuth 2.0 provider can be
                   used.
        kwargs: dict, Extra key-value pairs (both strings) to send in the
                payload body when making an assertion.
    é  Ú_signerNÚ c	                 óæ   •— t          t          | ¦  «                             d |||¬¦  «         || _        || _        t          j        |¦  «        | _        || _        || _	        || _
        |	| _        d S )N)Ú
user_agentÚ	token_uriÚ
revoke_uri)Úsuperr
   Ú__init__Ú_service_account_emailr   r   Úscopes_to_stringÚ_scopesÚ_private_key_idÚ	client_idÚ_user_agentÚ_kwargs)ÚselfÚservice_account_emailÚsignerÚscopesÚprivate_key_idr   r   r   r   ÚkwargsÚ	__class__s             €úa/root/disk_3tb/conda_envs/Huy-visual/lib/python3.11/site-packages/oauth2client/service_account.pyr   z"ServiceAccountCredentials.__init___   s|   ø€ õ 	Õ'¨Ñ.Ô.×7Ò7Ø˜Z°9Ø!ð 	8ñ 	#ô 	#ð 	#ð '<ˆÔ#ØˆŒÝÔ0°Ñ8Ô8ˆŒØ-ˆÔØ"ˆŒØ%ˆÔØˆŒˆˆó    c                 óþ   •— |€t          j         | j        ¦  «        }|                     t          ¦  «        }|�t	          j        |¦  «        |t          <   t          t          | ¦  «                             ||¬¦  «        S )ac  Utility function that creates JSON repr. of a credentials object.

        Over-ride is needed since PKCS#12 keys will not in general be JSON
        serializable.

        Args:
            strip: array, An array of names of members to exclude from the
                   JSON.
            to_serialize: dict, (Optional) The properties for this object
                          that will be serialized. This allows callers to
                          modify before serializing.

        Returns:
            string, a JSON representation of this instance, suitable to pass to
            from_json().
        N)Úto_serialize)	ÚcopyÚ__dict__ÚgetÚ_PKCS12_KEYÚbase64Ú	b64encoder   r
   Ú_to_json)r   Ústripr%   Ú
pkcs12_valr!   s       €r"   r,   z"ServiceAccountCredentials._to_jsonv   sw   ø€ ð" ÐÝœ9 T¤]Ñ3Ô3ˆLØ!×%Ò%¥kÑ2Ô2ˆ
ØÐ!Ý(.Ô(8¸Ñ(DÔ(DˆL�Ñ%ÝÕ.°Ñ5Ô5×>Ò>Ø ð ?ñ .ô .ð 	.r#   c           	      óÀ  — |                      d¦  «        }|t          j        k    rt          d|dt          j        ¦  «        ‚|d         }|d         }|d         }|d         }	|s |                      dt          j        ¦  «        }|s |                      d	t          j        ¦  «        }t          j         	                    |¦  «        }
 | ||
|||	||¬
¦  «        }||_
        |S )a	  Helper for factory constructors from JSON keyfile.

        Args:
            keyfile_dict: dict-like object, The parsed dictionary-like object
                          containing the contents of the JSON keyfile.
            scopes: List or string, Scopes to use when acquiring an
                    access token.
            token_uri: string, URI for OAuth 2.0 provider token endpoint.
                       If unset and not present in keyfile_dict, defaults
                       to Google's endpoints.
            revoke_uri: string, URI for OAuth 2.0 provider revoke endpoint.
                       If unset and not present in keyfile_dict, defaults
                       to Google's endpoints.

        Returns:
            ServiceAccountCredentials, a credentials object created from
            the keyfile contents.

        Raises:
            ValueError, if the credential type is not :data:`SERVICE_ACCOUNT`.
            KeyError, if one of the expected keys is not present in
                the keyfile.
        ÚtypezUnexpected credentials typeÚExpectedÚclient_emailÚprivate_keyr   r   r   r   )r   r   r   r   r   )r(   r   ÚSERVICE_ACCOUNTÚ
ValueErrorÚoauth2clientÚGOOGLE_TOKEN_URIÚGOOGLE_REVOKE_URIr   ÚSignerÚfrom_stringÚ_private_key_pkcs8_pem)ÚclsÚkeyfile_dictr   r   r   Ú
creds_typer   Úprivate_key_pkcs8_pemr   r   r   Úcredentialss               r"   Ú_from_parsed_json_keyfilez3ServiceAccountCredentials._from_parsed_json_keyfile�   s  € ð4 "×%Ò% fÑ-Ô-ˆ
Ø�Ô/Ò/Ð/ÝÐ:¸JØ'­Ô)?ñAô Að Að !-¨^Ô <ÐØ ,¨]Ô ;ÐØ%Ð&6Ô7ˆØ  Ô-ˆ	Øð 	HØ$×(Ò(¨Ý)5Ô)FñHô HˆIàð 	JØ%×)Ò)¨,Ý*6Ô*HñJô JˆJõ ”×)Ò)Ð*?Ñ@Ô@ˆØ�cÐ/°ÀØ)7Ø$-¸Ø%/ð1ñ 1ô 1ˆð .CˆÔ*ØÐr#   c                 ó¬   — t          |d¦  «        5 }t          j        |¦  «        }ddd¦  «         n# 1 swxY w Y   |                      ||||¬¦  «        S )a­  Factory constructor from JSON keyfile by name.

        Args:
            filename: string, The location of the keyfile.
            scopes: List or string, (Optional) Scopes to use when acquiring an
                    access token.
            token_uri: string, URI for OAuth 2.0 provider token endpoint.
                       If unset and not present in the key file, defaults
                       to Google's endpoints.
            revoke_uri: string, URI for OAuth 2.0 provider revoke endpoint.
                       If unset and not present in the key file, defaults
                       to Google's endpoints.

        Returns:
            ServiceAccountCredentials, a credentials object created from
            the keyfile.

        Raises:
            ValueError, if the credential type is not :data:`SERVICE_ACCOUNT`.
            KeyError, if one of the expected keys is not present in
                the keyfile.
        ÚrN©r   r   )ÚopenÚjsonÚloadrA   )r<   Úfilenamer   r   r   Úfile_objÚclient_credentialss          r"   Úfrom_json_keyfile_namez0ServiceAccountCredentials.from_json_keyfile_nameÁ   s¡   € õ4 �(˜CÑ Ô ð 	5 HÝ!%¤¨8Ñ!4Ô!4Ðð	5ð 	5ð 	5ñ 	5ô 	5ð 	5ð 	5ð 	5ð 	5ð 	5ð 	5øøøð 	5ð 	5ð 	5ð 	5à×,Ò,Ð-?ÀØ7@Ø8Bð -ñ Dô Dð 	Dó   ‘2²6¹6c                 ó4   — |                       ||||¬¦  «        S )a  Factory constructor from parsed JSON keyfile.

        Args:
            keyfile_dict: dict-like object, The parsed dictionary-like object
                          containing the contents of the JSON keyfile.
            scopes: List or string, (Optional) Scopes to use when acquiring an
                    access token.
            token_uri: string, URI for OAuth 2.0 provider token endpoint.
                       If unset and not present in keyfile_dict, defaults
                       to Google's endpoints.
            revoke_uri: string, URI for OAuth 2.0 provider revoke endpoint.
                       If unset and not present in keyfile_dict, defaults
                       to Google's endpoints.

        Returns:
            ServiceAccountCredentials, a credentials object created from
            the keyfile.

        Raises:
            ValueError, if the credential type is not :data:`SERVICE_ACCOUNT`.
            KeyError, if one of the expected keys is not present in
                the keyfile.
        rD   )rA   )r<   r=   r   r   r   s        r"   Úfrom_json_keyfile_dictz0ServiceAccountCredentials.from_json_keyfile_dictá   s.   € ð4 ×,Ò,¨\¸6Ø7@Ø8Bð -ñ Dô Dð 	Dr#   c                 óì   — |€t           }t          j        t          j        urt	          t
          ¦  «        ‚t          j                             ||¦  «        } | |||||¬¦  «        }||_        ||_        |S )ax  Factory constructor from JSON keyfile.

        Args:
            service_account_email: string, The email associated with the
                                   service account.
            private_key_pkcs12: string, The contents of a PKCS#12 keyfile.
            private_key_password: string, (Optional) Password for PKCS#12
                                  private key. Defaults to ``notasecret``.
            scopes: List or string, (Optional) Scopes to use when acquiring an
                    access token.
            token_uri: string, URI for token endpoint. For convenience defaults
                       to Google's endpoints but any OAuth 2.0 provider can be
                       used.
            revoke_uri: string, URI for revoke endpoint. For convenience
                        defaults to Google's endpoints but any OAuth 2.0
                        provider can be used.

        Returns:
            ServiceAccountCredentials, a credentials object created from
            the keyfile.

        Raises:
            NotImplementedError if pyOpenSSL is not installed / not the
            active crypto library.
        N)r   r   r   )	Ú_PASSWORD_DEFAULTr   r9   ÚOpenSSLSignerÚNotImplementedErrorÚ_PKCS12_ERRORr:   r   Ú_private_key_password)	r<   r   Úprivate_key_pkcs12Úprivate_key_passwordr   r   r   r   r@   s	            r"   Ú_from_p12_keyfile_contentsz4ServiceAccountCredentials._from_p12_keyfile_contentsÿ   sˆ   € ð>  Ð'Ý#4Ð ÝŒ<�uÔ2Ð2Ð2Ý%¥mÑ4Ô4Ð4Ý”×)Ò)Ð*<Ø*>ñ@ô @ˆà�cÐ/°ÀØ$-¸*ðFñ Fô Fˆà*<ˆÔ'Ø,@ˆÔ)ØÐr#   c                 ó°   — t          |d¦  «        5 }|                     ¦   «         }ddd¦  «         n# 1 swxY w Y   |                      ||||||¬¦  «        S )ap  Factory constructor from JSON keyfile.

        Args:
            service_account_email: string, The email associated with the
                                   service account.
            filename: string, The location of the PKCS#12 keyfile.
            private_key_password: string, (Optional) Password for PKCS#12
                                  private key. Defaults to ``notasecret``.
            scopes: List or string, (Optional) Scopes to use when acquiring an
                    access token.
            token_uri: string, URI for token endpoint. For convenience defaults
                       to Google's endpoints but any OAuth 2.0 provider can be
                       used.
            revoke_uri: string, URI for revoke endpoint. For convenience
                        defaults to Google's endpoints but any OAuth 2.0
                        provider can be used.

        Returns:
            ServiceAccountCredentials, a credentials object created from
            the keyfile.

        Raises:
            NotImplementedError if pyOpenSSL is not installed / not the
            active crypto library.
        ÚrbN©rV   r   r   r   )rE   ÚreadrW   )	r<   r   rH   rV   r   r   r   rI   rU   s	            r"   Úfrom_p12_keyfilez*ServiceAccountCredentials.from_p12_keyfile*  s¡   € õ> �(˜DÑ!Ô!ð 	1 XØ!)§¢¡¤Ðð	1ð 	1ð 	1ñ 	1ô 	1ð 	1ð 	1ð 	1ð 	1ð 	1ð 	1øøøð 	1ð 	1ð 	1ð 	1à×-Ò-Ø!Ð#5Ø!5¸fØ¨Jð .ñ 8ô 8ð 	8rL   c                 ó`   — |                      ¦   «         }|                      ||||||¬¦  «        S )a²  Factory constructor from JSON keyfile.

        Args:
            service_account_email: string, The email associated with the
                                   service account.
            file_buffer: stream, A buffer that implements ``read()``
                         and contains the PKCS#12 key contents.
            private_key_password: string, (Optional) Password for PKCS#12
                                  private key. Defaults to ``notasecret``.
            scopes: List or string, (Optional) Scopes to use when acquiring an
                    access token.
            token_uri: string, URI for token endpoint. For convenience defaults
                       to Google's endpoints but any OAuth 2.0 provider can be
                       used.
            revoke_uri: string, URI for revoke endpoint. For convenience
                        defaults to Google's endpoints but any OAuth 2.0
                        provider can be used.

        Returns:
            ServiceAccountCredentials, a credentials object created from
            the keyfile.

        Raises:
            NotImplementedError if pyOpenSSL is not installed / not the
            active crypto library.
        rZ   )r[   rW   )r<   r   Úfile_bufferrV   r   r   r   rU   s           r"   Úfrom_p12_keyfile_bufferz1ServiceAccountCredentials.from_p12_keyfile_bufferP  sC   € ð> )×-Ò-Ñ/Ô/ÐØ×-Ò-Ø!Ð#5Ø!5¸fØ¨Jð .ñ 8ô 8ð 	8r#   c                 óö   — t          t          j        ¦   «         ¦  «        }| j        | j        ||| j        z   | j        dœ}|                     | j        ¦  «         t          j	        | j
        || j        ¬¦  «        S )z8Generate the assertion that will be used in the request.)ÚaudÚscopeÚiatÚexpÚiss©Úkey_id)ÚintÚtimer   r   ÚMAX_TOKEN_LIFETIME_SECSr   Úupdater   r   Úmake_signed_jwtr   r   )r   ÚnowÚpayloads      r"   Ú_generate_assertionz-ServiceAccountCredentials._generate_assertionu  s   € å•$”)‘+”+ÑÔˆà”>Ø”\ØØ˜Ô5Ñ5ØÔ.ð
ð 
ˆð 	�Š�t”|Ñ$Ô$Ð$ÝÔ$ T¤\°7Ø,0Ô,@ðBñ Bô Bð 	Br#   c                 óD   — | j         | j                             |¦  «        fS )aU  Cryptographically sign a blob (of bytes).

        Implements abstract method
        :meth:`oauth2client.client.AssertionCredentials.sign_blob`.

        Args:
            blob: bytes, Message to be signed.

        Returns:
            tuple, A pair of the private key ID used to sign the blob and
            the signed contents.
        )r   r   Úsign)r   Úblobs     r"   Ú	sign_blobz#ServiceAccountCredentials.sign_blobƒ  s"   € ð Ô# T¤\×%6Ò%6°tÑ%<Ô%<Ð<Ð<r#   c                 ó   — | j         S )zŒGet the email for the current service account.

        Returns:
            string, The email associated with the service account.
        )r   ©r   s    r"   r   z/ServiceAccountCredentials.service_account_email’  s   € ð Ô*Ð*r#   c                 ó:   — d| j         | j        | j        | j        dœS )NÚservice_account)r0   r2   r   r3   r   )r   r   r;   r   ru   s    r"   Úserialization_dataz,ServiceAccountCredentials.serialization_data›  s-   € ð &Ø Ô7Ø"Ô2ØÔ6Øœð
ð 
ð 	
r#   c                 ó  — t          |t          ¦  «        s&t          j        t	          j        |¦  «        ¦  «        }d}|                     t          ¦  «        }d}|€(|d         }t          j	         
                    |¦  «        }n<t          j        |¦  «        }|d         }t          j	         
                    ||¦  «        } | |d         |f|d         |d         |d         |d         d	œ|d
         ¤Ž}|�||_        |�||_        |�||_        |d         |_        |d         |_        |d         |_        |d         |_        |                     dd¦  «        }|�/t(          j                             |t,          j        ¦  «        |_        |S )aM  Deserialize a JSON-serialized instance.

        Inverse to :meth:`to_json`.

        Args:
            json_data: dict or string, Serialized JSON (as a string or an
                       already parsed dictionary) representing a credential.

        Returns:
            ServiceAccountCredentials from the serialized data.
        Nr;   rT   r   r   r   r   r   ©r   r   r   r   r   ÚinvalidÚaccess_tokenr   r   Útoken_expiry)Ú
isinstanceÚdictrF   Úloadsr   Ú_from_bytesr(   r)   r   r9   r:   r*   Ú	b64decoder;   r   rT   r{   r|   r   r   ÚdatetimeÚstrptimer   ÚEXPIRY_FORMATr}   )r<   Ú	json_datar?   r.   Úpasswordr   r@   r}   s           r"   Ú	from_jsonz#ServiceAccountCredentials.from_json¦  s¦  € õ ˜)¥TÑ*Ô*ð 	DÝœ
¥8Ô#7¸	Ñ#BÔ#BÑCÔCˆIà $ÐØ—]’]¥;Ñ/Ô/ˆ
ØˆØÐØ$-Ð.FÔ$GÐ!Ý”\×-Ò-Ð.CÑDÔDˆFˆFõ
  Ô)¨*Ñ5Ô5ˆJØ Ð!8Ô9ˆHÝ”\×-Ò-¨j¸(ÑCÔCˆFà�cØÐ.Ô/Øð
ð ˜YÔ'Ø$Ð%6Ô7Ø Ô,Ø  Ô/ð
ð 
ð ˜	Ô"ð
ð 
ˆð !Ð,Ø1FˆKÔ.ØÐ!Ø.8ˆKÔ+ØÐØ08ˆKÔ-Ø'¨	Ô2ˆÔØ#,¨^Ô#<ˆÔ Ø )¨+Ô 6ˆÔØ!*¨<Ô!8ˆÔØ —}’} ^°TÑ:Ô:ˆØÐ#Ý'/Ô'8×'AÒ'AØ�fÔ2ñ(4ô (4ˆKÔ$àÐr#   c                 ó   — | j          S ©N)r   ru   s    r"   Úcreate_scoped_requiredz0ServiceAccountCredentials.create_scoped_requiredÝ  s   € Ø”<ÐÐr#   c                 óâ   —  | j         | j        | j        f|| j        | j        | j        dœ| j        ¤Ž}| j        |_        | j        |_        | j	        |_	        | j
        |_
        | j        |_        |S )Nrz   )r!   r   r   r   r   r   r   r   r   r;   r   rT   )r   r   Úresults      r"   Úcreate_scopedz'ServiceAccountCredentials.create_scopedà  s…   € Ø�” Ô ;Ø $¤ð0à'-Ø/3Ô/CØ*.¬.Ø+/Ô+;ð0ð 0ð #'¤,ð0ð 0ˆð  œ>ˆÔØ œOˆÔØ(,Ô(CˆÔ%Ø%)Ô%=ˆÔ"Ø'+Ô'AˆÔ$Øˆr#   c                 ó4  — t          | j        ¦  «        }|                     |¦  «          | j        | j        | j        f| j        | j        | j        | j	        dœ|¤Ž}| j
        |_
        | j        |_        | j        |_        | j        |_        | j        |_        |S )a<  Create credentials that specify additional claims.

        Args:
            claims: dict, key-value pairs for claims.

        Returns:
            ServiceAccountCredentials, a copy of the current service account
            credentials with updated claims to use when obtaining access
            tokens.
        rz   )r   r   rk   r!   r   r   r   r   r   r   r   r   r;   r   rT   )r   ÚclaimsÚ
new_kwargsr�   s       r"   Úcreate_with_claimsz,ServiceAccountCredentials.create_with_claimsï  sª   € õ ˜$œ,Ñ'Ô'ˆ
Ø×Ò˜&Ñ!Ô!Ð!Ø�” Ô ;Ø $¤ð.à'+¤|Ø/3Ô/CØ*.¬.Ø+/Ô+;ð.ð .ð #-ð.ð .ˆð  œ>ˆÔØ œOˆÔØ(,Ô(CˆÔ%Ø%)Ô%=ˆÔ"Ø'+Ô'AˆÔ$Øˆr#   c                 ó0   — |                       d|i¦  «        S )aY  Create credentials that act as domain-wide delegation of authority.

        Use the ``sub`` parameter as the subject to delegate on behalf of
        that user.

        For example::

          >>> account_sub = 'foo@email.com'
          >>> delegate_creds = creds.create_delegated(account_sub)

        Args:
            sub: string, An email address that this service account will
                 act on behalf of (via domain-wide delegation).

        Returns:
            ServiceAccountCredentials, a copy of the current service account
            updated to act on behalf of ``sub``.
        Úsub)r’   )r   r”   s     r"   Úcreate_delegatedz*ServiceAccountCredentials.create_delegated
  s   € ð& ×&Ò&¨¨s |Ñ4Ô4Ð4r#   rŠ   ©NN)r   NN)#Ú__name__Ú
__module__Ú__qualname__Ú__doc__rj   Ú	frozensetr   ÚAssertionCredentialsÚNON_SERIALIZED_MEMBERSr;   r   rT   r6   r7   r8   r   r,   ÚclassmethodrA   rK   rN   rW   r\   r_   ro   rs   Úpropertyr   rx   rˆ   r‹   rŽ   r’   r•   Ú__classcell__©r!   s   @r"   r
   r
   *   sˆ  ø€ € € € € ð$ð $ðL #ÐØ;ð 	ˆ	�9�+ÑÔØÔ#Ô:ñ	;ð ð Kð "ÐØÐØ Ðð
 Ø $ØØ Ø'Ô8Ø(Ô:ðð ð ð ð ð ð..ð .ð .ð .ð .ð .ð2 à=Að/ð /ð /ñ „[ð/ðb Ø57Ø:>ðDð Dð Dñ „[ðDð> Ø9;Ø:>ðDð Dð Dñ „[ðDð: ð 9=ÀRØ-9Ô-JØ.:Ô.Lð	(ð (ð (ñ „[ð(ðT à.2¸2Ø#/Ô#@Ø$0Ô$Bð#8ð #8ð #8ñ „[ð#8ðJ à59À"Ø*6Ô*GØ+7Ô+Ið"8ð "8ð "8ñ „[ð"8ðHBð Bð Bð=ð =ð =ð ð+ð +ñ „Xð+ð ð
ð 
ñ „Xð
ð ð4ð 4ñ „[ð4ðl ð  ð  ðð ð ðð ð ð65ð 5ð 5ð 5ð 5ð 5ð 5r#   r
   c                 ó\   — t          j         ddd¦  «        }| |z
  }|j        dz  |j        z   S )Ni²  é   i€Q )rƒ   ÚdaysÚseconds)Úutc_timeÚepochÚ
time_deltas      r"   Ú_datetime_to_secsr©      s7   € õ Ô˜d A qÑ)Ô)€EØ˜EÑ!€JØŒ?˜UÑ" ZÔ%7Ñ7Ð7r#   c                   óš   ‡ — e Zd ZdZdZ	 ddddej        ej        dfˆ fd„	Zd„ Z	dd„Z
d„ Zd„ Zej        ej        fd	„Zd
„ Zd„ Zdd„Zˆ xZS )Ú_JWTAccessCredentialszÐSelf signed JWT credentials.

    Makes an assertion to server using a self signed JWT from service account
    credentials.  These credentials do NOT use OAuth 2.0 and instead
    authenticate directly.
    r   Nc
           	      ó`   •— |	€i }	 t          t          | ¦  «        j        ||f|||||dœ|	¤Ž d S )N)r   r   r   r   r   )r   r«   r   )r   r   r   r   r   r   r   r   r   Úadditional_claimsr!   s             €r"   r   z_JWTAccessCredentials.__init__2  sh   ø€ ð Ð$Ø "ÐØ3�Õ# TÑ*Ô*Ô3Ø!Øð	!ð *ØØ!ØØ!ð	!ð 	!ð  ð	!ð 	!ð 	!ð 	!ð 	!r#   c                 ó0   — t          j        | |¦  «         |S )aÁ  Authorize an httplib2.Http instance with a JWT assertion.

        Unless specified, the 'aud' of the assertion will be the base
        uri of the request.

        Args:
            http: An instance of ``httplib2.Http`` or something that acts
                  like it.
        Returns:
            A modified instance of http that was passed in.
        Example::
            h = httplib2.Http()
            h = credentials.authorize(h)
        )r   Úwrap_http_for_jwt_access©r   Úhttps     r"   Ú	authorizez_JWTAccessCredentials.authorizeH  s   € õ 	Ô*¨4°Ñ6Ô6Ð6Øˆr#   c                 ó  — |€P| j         �| j        r|                      d¦  «         t          j        | j         |                      ¦   «         ¬¦  «        S |                      |¦  «        \  }}t          j        || j        ¬¦  «        S )zòCreate a signed jwt.

        Args:
            http: unused
            additional_claims: dict, additional claims to add to
                the payload of the JWT.
        Returns:
            An AccessTokenInfo with the signed jwt
        N)r|   Ú
expires_in)r|   Úaccess_token_expiredÚrefreshr   ÚAccessTokenInfoÚ_expires_inÚ_create_tokenÚ_MAX_TOKEN_LIFETIME_SECS)r   r±   r­   ÚtokenÚunused_expirys        r"   Úget_access_tokenz&_JWTAccessCredentials.get_access_tokenZ  s    € ð Ð$ØÔ Ð(¨DÔ,EÐ(Ø—’˜TÑ"Ô"Ð"ÝÔ)ØÔ,¸×9IÒ9IÑ9KÔ9KðMñ Mô Mð Mð $(×#5Ò#5Ð6GÑ#HÔ#HÑ ˆE�=ÝÔ)Ø ¨TÔ-JðLñ Lô Lð Lr#   c                 ó   — dS )z*Cannot revoke JWTAccessCredentials tokens.N© r°   s     r"   Úrevokez_JWTAccessCredentials.revokeo  s   € àˆr#   c                 ó   — dS )NTr¿   ru   s    r"   r‹   z,_JWTAccessCredentials.create_scoped_requireds  s   € àˆtr#   c           
      óÞ   — t          | j        | j        f|| j        | j        | j        ||dœ| j        ¤Ž}| j        �| j        |_        | j        �| j        |_        | j	        �| j	        |_	        |S )N)r   r   r   r   r   r   )
r
   r   r   r   r   r   r   r;   r   rT   )r   r   r   r   r�   s        r"   rŽ   z#_JWTAccessCredentials.create_scopedw  s�   € õ +¨4Ô+FØ+/¬<ð;à28Ø:>Ô:NØ59´^Ø6:Ô6FØ5>Ø6@ð;ð ;ð .2¬\ð;ð ;ˆð Ô&Ð2Ø,0Ô,GˆFÔ)ØÔ#Ð/Ø)-Ô)AˆFÔ&ØÔ%Ð1Ø+/Ô+EˆFÔ(Øˆr#   c                 ó0   — |                       d¦  «         dS )zÛRefreshes the access_token.

        The HTTP object is unused since no request needs to be made to
        get a new token, it can just be generated locally.

        Args:
            http: unused HTTP object
        N)Ú_refreshr°   s     r"   r¶   z_JWTAccessCredentials.refresh‹  s   € ð 	�Š�dÑÔÐÐÐr#   c                 óH   — |                       ¦   «         \  | _        | _        dS )zXRefreshes the access_token.

        Args:
            http: unused HTTP object
        N)r¹   r|   r}   r°   s     r"   rÄ   z_JWTAccessCredentials._refresh–  s&   € ð 04×/AÒ/AÑ/CÔ/CÑ,ˆÔ˜4Ô,Ð,Ð,r#   c                 óŽ  — t          j        ¦   «         }t          j        | j        ¬¦  «        }||z   }t          |¦  «        t          |¦  «        | j        | j        dœ}|                     | j        ¦  «         |�|                     |¦  «         t          j
        | j        || j        ¬¦  «        }|                     d¦  «        |fS )N)r¥   )rc   rd   re   r”   rf   Úascii)r   Ú_UTCNOWrƒ   Ú	timedeltarº   r©   r   rk   r   r   rl   r   r   Údecode)r   r­   rm   ÚlifetimeÚexpiryrn   Újwts          r"   r¹   z#_JWTAccessCredentials._create_tokenž  sÈ   € ÝŒnÑÔˆÝÔ%¨dÔ.KÐLÑLÔLˆØ�x‘ˆå$ SÑ)Ô)Ý$ VÑ,Ô,ØÔ.ØÔ.ð	
ð 
ˆð 	�Š�t”|Ñ$Ô$Ð$ØÐ(Ø�NŠNÐ,Ñ-Ô-Ð-ÝÔ# D¤L°'Ø+/Ô+?ðAñ Aô Aˆà�zŠz˜'Ñ"Ô" FÐ*Ð*r#   r–   rŠ   )r—   r˜   r™   rš   rº   r6   r7   r8   r   r²   r½   rÀ   r‹   rŽ   r¶   rÄ   r¹   r    r¡   s   @r"   r«   r«   (  s  ø€ € € € € ðð ð  $ÐØ;ð
 Ø $ØØ Ø'Ô8Ø(Ô:Ø#'ð!ð !ð !ð !ð !ð !ð,ð ð ð$Lð Lð Lð Lð*ð ð ðð ð ð /;Ô.KØ!-Ô!?ðð ð ð ð(	ð 	ð 	ðDð Dð Dð+ð +ð +ð +ð +ð +ð +ð +r#   r«   )rš   r*   r&   rƒ   rF   ri   r6   r   r   r   r   rP   r)   rS   rœ   r
   r©   r«   r¿   r#   r"   ú<module>rÎ      s&  ðð 6Ð 5à €€€Ø €€€Ø €€€Ø €€€Ø €€€à Ð Ð Ð Ø !Ð !Ð !Ð !Ð !Ð !Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø "Ð "Ð "Ð "Ð "Ð "ð !Ð Ø#€ð€ðs5ð s5ð s5ð s5ð s5 Ô ;ñ s5ô s5ð s5ðl8ð 8ð 8ðE+ð E+ð E+ð E+ð E+Ð5ñ E+ô E+ð E+ð E+ð E+r#   