
    ̸d}	                     P    d dl mZ d dlmZ d dlZd dlmZ d dlmZ d dlm	Z	 d Z
dS )    )User)
exceptionsN)settings)Response)statusc                    | j                             d          }t          d|           |st          d          	 |}t          d|           t	          j        |t          j        dg          }t          d|           nb# t          j        $ r$ t          d           t          j
        d	          t          $ r$ t          d
           t          j
        d          w xY wt          j                            |d                   }|t          j
        d          |j        st          j
        d          t          |j                  S )NAuthorizationauthorization_headerzAuthentication failedaccess_tokenHS256)
algorithmspayloadexcepzaccess_token expiredexcep2zToken prefix missinguser_id)idzUser not foundzuser is inactive)headersgetprint	Exceptionjwtdecoder   
SECRET_KEYExpiredSignatureErrorr   AuthenticationFailed
IndexErrorr   objects	is_activestrr   )requestr
   r   r   userIDs        :/var/www/html/Sam_Eipo/Eipo/customer_api/authentication.pyauthenticatedr#      sc   ++O<<2333 +)***@%,|$$$J$'< < <'	'! @ @ @...'(>??? @ @ @///'(>???@ ,

gi0

1
1
N'(8999 <'(:;;;FIs   AB AC!)django.contrib.auth.modelsr   rest_frameworkr   r   django.confr   rest_framework.responser   r   r#        r"   <module>r*      s    + + + + + + % % % % % % 



             , , , , , , ! ! ! ! ! !    r)   