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/oauth2client/contrib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/site-packages/oauth2client/contrib/__pycache__/xsrfutil.cpython-38.pyc
U

O��g�
�@sddZddlZddlZddlZddlZddlmZdZdZe�	d�d
dd	��Z
e�	d
�ddd��ZdS)z4Helper methods for creating & verifying XSRF tokens.�N)�_helpers�:i��cCs�t�tj|dd��}|�tjt|�dd��|�t�|�tj|dd��|�t�tjt|phtt����dd�}|�|�|�	�}t
�|t|�}|S)a�Generates a URL-safe token for the given user, action, time tuple.

    Args:
        key: secret key to use.
        user_id: the user ID of the authenticated user.
        action_id: a string identifier of the action they requested
                   authorization for.
        when: the time in seconds since the epoch at which the user was
              authorized for this action. If not set the current time is used.

    Returns:
        A string XSRF protection token.
    zutf-8)�encoding)�hmac�newr�	_to_bytes�update�str�	DELIMITER�int�time�digest�base64�urlsafe_b64encode)�key�user_id�	action_id�whenZdigesterr�token�r�J/opt/cppython/lib/python3.8/site-packages/oauth2client/contrib/xsrfutil.py�generate_token s


r�c
Cs�|sdSz t�|�}t|�t�d�}Wntttjfk
rFYdSX|dkrXt	�	�}||t
krhdSt||||d�}t|�t|�kr�dSd}t
t|�t|��D]\}	}
||	|
AO}q�|S)aRValidates that the given token authorizes the user for the action.

    Tokens are invalid if the time of issue is too old or if the token
    does not match what generateToken outputs (i.e. the token was forged).

    Args:
        key: secret key to use.
        token: a string of the token generated by generateToken.
        user_id: the user ID of the authenticated user.
        action_id: a string identifier of the action they requested
                   authorization for.

    Returns:
        A boolean - True if the user is authorized for the action, False
        otherwise.
    F���N)rrr)r�urlsafe_b64decoder
�splitr�	TypeError�
ValueError�binascii�Errorr�DEFAULT_TIMEOUT_SECSr�len�zip�	bytearray)rrrr�current_time�decodedZ
token_timeZexpected_tokenZ	different�x�yrrr�validate_token<s(
�r*)rN)rN)�__doc__rr rrZoauth2clientrrr"�
positionalrr*rrrr�<module>s

F1le Man4ger