o
    wvXjB	  ã                   @   s”   d Z ddlmZm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dZzddlZW n ey;   e	eƒ‚w 		ddd„Zddd„ZdS )zMessage Signing Serializer.é    )Úabsolute_importÚunicode_literals)Údisable_insecure_serializers)Úregistry)ÚImproperlyConfiguredé   )Úregister_authz|You need to install the cryptography library to use the auth serializer.
Please install by:

    $ pip install cryptography
zçSorry, but you have to configure the
    * security_key
    * security_certificate, and the
    * security_cert_store
configuration settings to use the auth serializer.

Please see the configuration reference for more information.
a  You have to configure a special task serializer
for signing and verifying tasks:
    * task_serializer = 'auth'

You have to accept only tasks which are serialized with 'auth'.
There is no point in signing messages if they are not verified.
    * accept_content = ['auth']
)Úsetup_securityNÚjsonc              	   C   sþ   |du rddl m} | ¡ }t| ƒ |j}|jdks |jdgkr$ttƒ‚|p(|j	}|p-|j
}|p2|j}|p7|j}|r>|r>|sBttƒ‚t|dƒ�)}	t|dƒ�}
t|	 ¡ |
 ¡ |||ƒ W d  ƒ n1 sdw   Y  W d  ƒ n1 ssw   Y  t d¡ dS )z#See :meth:`@Celery.setup_security`.Nr   )Úcurrent_appÚauthÚr)Úceleryr   Ú_get_current_objectÚ_disable_insecure_serializersÚconfÚtask_serializerÚaccept_contentr   ÚSETTING_MISSINGÚsecurity_keyÚsecurity_certificateÚsecurity_cert_storeÚsecurity_digestÚSECURITY_SETTING_MISSINGÚopenr   Úreadr   Ú_set_default_serializer)Úallowed_serializersÚkeyÚcertÚstoreÚdigestÚ
serializerÚappr   r   ÚkfÚcf© r&   úU/var/www/html/myproject/venv/lib/python3.10/site-packages/celery/security/__init__.pyr	   0   s(   



ÿ€ÿr	   c                 C   s   t | d� d S )N)Úallowed)r   )Ú	whitelistr&   r&   r'   Údisable_untrusted_serializersL   s   r*   )NNNNNr
   N)N)Ú__doc__Ú
__future__r   r   Úkombu.serializationr   r   r   Úcelery.exceptionsr   Úserializationr   ÚCRYPTOGRAPHY_NOT_INSTALLEDr   r   Ú__all__ÚcryptographyÚImportErrorr	   r*   r&   r&   r&   r'   Ú<module>   s&   

ÿ
ÿ