
    ~g8                     n    d dl mZ d dlmZ d dlmZ d dlZd dlmZ  e            Z	 G d de          Z
dS )    )BaseAuthentication)AuthenticationFailed)settingsN)get_user_modelc                       e Zd Zd ZdS )CustomJWTAuthenticationc                    |j                             d          }|sd S 	 |                                d         }t          j        |t
          j        dg          }|d         }t          j                            |          }|d fS # t          j	        $ r t          d          t          j        $ r t          d          t          j        $ r t          d	          w xY w)
NAuthorization   HS256)
algorithmsuser_id)pkzToken has expiredzToken is invalidzUser not found)headersgetsplitjwtdecoder   
SECRET_KEYUserobjectsExpiredSignatureErrorr   InvalidTokenErrorDoesNotExist)selfrequestauth_headertokenpayloadr   users          </var/www/html/e360mart/login_signup/custom_authentication.pyauthenticatez$CustomJWTAuthentication.authenticate   s    o))/:: 	4	9%%''*Ej(;	RRRGi(G<##w#//D$<( 	< 	< 	<&':;;;$ 	; 	; 	;&'9:::  	9 	9 	9&'7888	9s   A'B AC!N)__name__
__module____qualname__r"        r!   r   r      s#        9 9 9 9 9r'   r   )rest_framework.authenticationr   rest_framework.exceptionsr   django.confr   r   django.contrib.authr   r   r   r&   r'   r!   <module>r,      s    < < < < < < : : : : : : !           



 . . . . . .n9 9 9 9 90 9 9 9 9 9r'   