o
    $i                     @   sj   zd dl mZmZmZ dZW n ey   dZY nw defddZdedefdd	Z	d
edefddZ
dS )    )AuthenticationModeget_authentication_modevalidate_authentication_tokenTFreturnc                   C   s   t sdS t tjtjhv S )zCheck if token authentication is enabled.

    Returns:
        bool: True if AUTH_MODE is set to "token" or "k8s", False otherwise
    F)_RAYLET_AVAILABLEr   r   TOKENK8S r	   r	   m/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/ray/_private/authentication/authentication_utils.pyis_token_auth_enabled   s   r   auth_headerc                 C   s   t r| sdS t| S )zValidate the Authorization header from an HTTP request.

    Args:
        auth_header: The Authorization header value (e.g., "Bearer <token>")

    Returns:
        bool: True if token is valid, False otherwise
    F)r   r   )r   r	   r	   r
   validate_request_token   s   	r   modec                 C   s.   ddl m} |jd|jd|jdi}|| dS )zConvert AuthenticationMode enum value to string name.

    Args:
        mode: AuthenticationMode enum value from ray._raylet

    Returns:
        String name: "disabled", "token", or "k8s"
    r   )r   disabledtokenk8sunknown)ray._rayletr   DISABLEDr   r   get)r   r   _MODE_NAMESr	   r	   r
   get_authentication_mode_name.   s   	r   N)r   r   r   r   r   ImportErrorboolr   strr   r   r	   r	   r	   r
   <module>   s    