|
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__/ |
U
O��g�( � @ s� d Z ddlZddlZddlZddlZddlmZ ddlmZ ddlm Z ddl
mZmZm
Z
dZdZd Zd
d� ZG dd
� d
ejd�ZG dd� de�ZG dd� de�ZG dd� 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�� c C s
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 @ sB e Zd ZdZeejdd� ��Zeejdd� ��Zejdd� �Z dS ) �ReauthChallengez!Base class for reauth challenges.c C s t d��dS )z"Returns the name of the challenge.z!name property must be implementedN��NotImplementedError��selfr
r
r �name: s zReauthChallenge.namec C s t d��dS )zAReturns true if a challenge is supported locally on this machine.z0is_locally_eligible property must be implementedNr r r
r
r �is_locally_eligible@ s z#ReauthChallenge.is_locally_eligiblec C s t d��dS )ac Performs 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_inputF s z&ReauthChallenge.obtain_challenge_inputN)
�__name__�
__module__�__qualname__�__doc__�property�abc�abstractmethodr r r r
r
r
r r
7 s r
)� metaclassc @ s: e Zd ZdZedd� �Zedd� �Ze�e �dd� �Z
dS ) �PasswordChallengez(Challenge that asks for user's password.c C s dS )NZPASSWORDr
r r
r
r r [ s zPasswordChallenge.namec C s dS �NTr
r r
r
r r _ s z%PasswordChallenge.is_locally_eligiblec C s t d�}|sd}d|iS )NzPlease enter your password:� Z
credential)r )r Zunused_metadata�passwdr
r
r r c s z(PasswordChallenge.obtain_challenge_inputN)r r r r r r r r �copy_docstringr
r r
r
r
r r X s
r c @ sJ e Zd ZdZedd� �Zedd� �Ze�e �dd� �Z
dd � Zd
d� ZdS )
�SecurityKeyChallengez2Challenge that asks for user's security key touch.c C s dS )NZSECURITY_KEYr
r r
r
r r n s zSecurityKeyChallenge.namec C s dS r r
r r
r
r r r s z(SecurityKeyChallenge.is_locally_eligiblec C s` z6t �� }|�� }|d k r4tj�d� | �||�W S W n tk
rJ Y nX zdd l}dd l }dd l
}W n tk
r� t�
d��Y nX |d }|d }|d }|d }||kr�||g} n|g} g }
|D ]P}|d �d �}|j�tt�|���}
|d
�d �}t�|�}|
�|
|d�� q�d}| D �]6}z8|d7 }|jj�t�}|j||
tjjd
�}d|iW S |jjk
�r� } zj|j|jjjk�r�|t| �k�r�tj�d� W Y �8 d S W Y �,�q"|j|jjjk�r�tj�d� n|�W 5 d }~X Y nh |jj k
�r0 } z tj�d�!|�� W Y ��q"W 5 d }~X Y n& |jj"k
�rT tj�d� Y nX d S d S )Nz*Please insert and touch your security key
r z�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.
)#r ZWebauthnHandlerFactoryZget_handler�sys�stderr�write� _obtain_challenge_input_webauthn� ExceptionZpyu2f.convenience.authenticatorZpyu2f.errorsZpyu2f.model�ImportErrorr ZReauthFailError�encode�modelZ
RegisteredKey� bytearray�base64�urlsafe_b64decode�appendZconvenienceZ
authenticatorZCreateCompositeAuthenticator�
REAUTH_ORIGINZAuthenticate�errorsZU2FError�codeZDEVICE_INELIGIBLE�len�TIMEOUTZPluginError�formatZNoDeviceFoundError)r r �factory�webauthn_handlerZpyu2f�skr&