Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/site-packages/google/oauth2/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/site-packages/google/oauth2/__pycache__/challenges.cpython-38.pyc
U

O��g�(�@s�dZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZm
Z
dZdZd	Zd
d�ZGdd
�d
ejd�ZGdd�de�ZGdd�de�ZGdd�de�Zdd�e�e�e�fD�ZdS)z" Challenges for reauthentication.
�N)�_helpers)�
exceptions)�webauthn_handler_factory)�$AuthenticationExtensionsClientInputs�
GetRequest�PublicKeyCredentialDescriptorzhttps://accounts.google.comzFPlease run `gcloud auth login` to complete reauthentication with SAML.i��cCs
t�|�S)z�Get password from user.

    Override this function with a different logic if you are using this library
    outside a CLI.

    Args:
        text (str): message for the password prompt.

    Returns:
        str: password string.
    )�getpass)�text�r
�E/opt/cppython/lib/python3.8/site-packages/google/oauth2/challenges.py�get_user_password(src@sBeZdZdZeejdd���Zeejdd���Zejdd��Z	dS)	�ReauthChallengez!Base class for reauth challenges.cCstd��dS)z"Returns the name of the challenge.z!name property must be implementedN��NotImplementedError��selfr
r
r�name:szReauthChallenge.namecCstd��dS)zAReturns true if a challenge is supported locally on this machine.z0is_locally_eligible property must be implementedNrrr
r
r�is_locally_eligible@sz#ReauthChallenge.is_locally_eligiblecCstd��dS)acPerforms logic required to obtain credentials and returns it.

        Args:
            metadata (Mapping): challenge metadata returned in the 'challenges' field in
                the initial reauth request. Includes the 'challengeType' field
                and other challenge-specific fields.

        Returns:
            response that will be send to the reauth service as the content of
            the 'proposalResponse' field in the request body. Usually a dict
            with the keys specific to the challenge. For example,
            ``{'credential': password}`` for password challenge.
        z1obtain_challenge_input method must be implementedNr�r�metadatar
r
r�obtain_challenge_inputFsz&ReauthChallenge.obtain_challenge_inputN)
�__name__�
__module__�__qualname__�__doc__�property�abc�abstractmethodrrrr
r
r
rr
7sr
)�	metaclassc@s:eZdZdZedd��Zedd��Ze�e	�dd��Z
dS)	�PasswordChallengez(Challenge that asks for user's password.cCsdS)NZPASSWORDr
rr
r
rr[szPasswordChallenge.namecCsdS�NTr
rr
r
rr_sz%PasswordChallenge.is_locally_eligiblecCstd�}|sd}d|iS)NzPlease enter your password:� Z
credential)r)rZunused_metadata�passwdr
r
rrcsz(PasswordChallenge.obtain_challenge_inputN)rrrrrrrr�copy_docstringr
rr
r
r
rrXs

rc@sJeZdZdZedd��Zedd��Ze�e	�dd��Z
dd	�Zd
d�ZdS)
�SecurityKeyChallengez2Challenge that asks for user's security key touch.cCsdS)NZSECURITY_KEYr
rr
r
rrnszSecurityKeyChallenge.namecCsdSr r
rr
r
rrrsz(SecurityKeyChallenge.is_locally_eligiblecCs`z6t��}|��}|dk	r4tj�d�|�||�WSWntk
rJYnXzddl}ddl	}ddl
}Wntk
r�t�
d��YnX|d}|d}|d}|d}||kr�||g}	n|g}	g}
|D]P}|d�d	�}|j�tt�|���}
|d
�d	�}t�|�}|
�|
|d��q�d}|	D�]6}z8|d7}|jj�t�}|j||
tjjd
�}d|iWS|jjk
�r�}zj|j|jjjk�r�|t|	�k�r�tj�d�WY�8dSWY�,�q"|j|jjjk�r�tj�d�n|�W5d}~XYnh|jj k
�r0}z tj�d�!|��WY��q"W5d}~XYn&|jj"k
�rTtj�d�YnXdSdS)Nz*Please insert and touch your security key
rz�pyu2f dependency is required to use Security key reauth feature. It can be installed via `pip install pyu2f` or `pip install google-auth[reauth]`.�securityKey�
challenges�
applicationId�relyingPartyId�	keyHandle�ascii�	challenge)�keyr+�)Zprint_callbackzIneligible security key.
z0Timed out while waiting for security key touch.
zPlugin error: {}.
zNo security key found.
)#rZWebauthnHandlerFactoryZget_handler�sys�stderr�write� _obtain_challenge_input_webauthn�	ExceptionZpyu2f.convenience.authenticatorZpyu2f.errorsZpyu2f.model�ImportErrorrZReauthFailError�encode�modelZ
RegisteredKey�	bytearray�base64�urlsafe_b64decode�appendZconvenienceZ
authenticatorZCreateCompositeAuthenticator�
REAUTH_ORIGINZAuthenticate�errorsZU2FError�codeZDEVICE_INELIGIBLE�len�TIMEOUTZPluginError�formatZNoDeviceFoundError)rr�factory�webauthn_handlerZpyu2f�skr&�application_id�relying_party_idZapplication_parametersZchallenge_data�c�khr,r+�triesZapp_id�api�response�er
r
rrvsx�



��
�z+SecurityKeyChallenge.obtain_challenge_inputc
Csx|�d�}|dkrt�d��|�d�}|�d�}|�d�}|dksNt|�dkrXt�d��|dkrjt�d��|dkr|t�d	��g}|D]:}|�d
�}	|	dkr�t�d��|�|	�}
|�t|
d��q�t|d
�}|d�d�}|dkr�t�d��tt	||�|�t
|d|d�}z|�|�}
Wn:tk
�rN}ztj
�d�|��|�W5d}~XYnX|
jj|
jj|
jj||
jdd�}d|iS)Nr%zsecurityKey is Noner&r'r(r-zchallenges is None or emptyzapplication_id is Nonezrelying_party_id is Noner)zkeyHandle is None)�id)Zappidrr+zchallenge is None�required)�originZrpidr+Z
timeout_ms�allow_credentialsZuser_verification�
extensionszWebauthn Error: {}.
�)Z
clientDataZauthenticatorDataZ
signatureDatar'r)ZsecurityKeyReplyType)�getrZInvalidValuer=�_unpadded_urlsafe_b64recoder9rrrr:�WEBAUTHN_TIMEOUT_MSr2r.r/r0r?rIZclient_data_jsonZauthenticator_data�	signaturerK)rrrArBr&rCrDrNr+rFZ
key_handle�	extension�get_requestZget_responserJrIr
r
rr1�sZ












�
�z5SecurityKeyChallenge._obtain_challenge_input_webauthncCst�|�}t�|����d�S)z\Converts standard b64 encoded string to url safe b64 encoded string
        with no padding.�=)r7r8�urlsafe_b64encode�decode�rstrip)r�s�br
r
rrR�s
z0SecurityKeyChallenge._unpadded_urlsafe_b64recodeN)
rrrrrrrrr#r
rr1rRr
r
r
rr$ks


K6r$c@s0eZdZdZedd��Zedd��Zdd�ZdS)	�
SamlChallengez�Challenge that asks the users to browse to their ID Providers.

    Currently SAML challenge is not supported. When obtaining the challenge
    input, exception will be raised to instruct the users to run
    `gcloud auth login` for reauthentication.
    cCsdS)NZSAMLr
rr
r
rrszSamlChallenge.namecCsdSr r
rr
r
rrsz!SamlChallenge.is_locally_eligiblecCst�t��dS)N)rZReauthSamlChallengeFailError�SAML_CHALLENGE_MESSAGErr
r
rrsz$SamlChallenge.obtain_challenge_inputN)rrrrrrrrr
r
r
rr]�s

r]cCsi|]}|j|�qSr
)r)�.0r+r
r
r�
<dictcomp>s�r`)rrr7rr.Zgoogle.authrrZ
google.oauth2rZgoogle.oauth2.webauthn_typesrrrr:r^rSr�ABCMetar
rr$r]ZAVAILABLE_CHALLENGESr
r
r
r�<module>s*�!�

F1le Man4ger