o
    Df;	                     @   s   d 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y3   ee	w 		dddZdddZdS )zMessage Signing Serializer.    )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
zSorry, 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}|p<|	j}|rC|rC|sGttt|)}
t|}t|
 || ||| W d   n1 shw   Y  W d   n1 sww   Y  td dS )z#See :meth:`@Celery.setup_security`.Nr   )current_appauth)celeryr	   _get_current_object_disable_insecure_serializersconftask_serializeraccept_contentr   SETTING_MISSINGsecurity_keysecurity_key_passwordsecurity_certificatesecurity_cert_storesecurity_digestSECURITY_SETTING_MISSINGopenr   readr   _set_default_serializer)allowed_serializerskeykey_passwordcertstoredigest
serializerappr	   r   kfcf r%   Q/home/ubuntu/webapp/venv/lib/python3.10/site-packages/celery/security/__init__.pyr   ,   s*   






r   c                 C   s   t | d d S )N)allowed)r   )	whitelistr%   r%   r&   disable_untrusted_serializersI   s   r)   )NNNNNNr   N)N)__doc__kombu.serializationr   r   r   celery.exceptionsr   serializationr   CRYPTOGRAPHY_NOT_INSTALLEDr   r   __all__cryptographyImportErrorr   r)   r%   r%   r%   r&   <module>   s$    


