o
    ֧-ga                     @   s8   d dl mZ ddlmZ d dlmZ G dd deZdS )    )JWTAuthentication   )
AdminTable)AuthenticationFailedc                   @   s   e Zd Zdd ZdS )AdminJWTAuthenticationc                 C   sH   | d}|d u rtdz
tjj |d}W |S  tjy#   tdw )Nuser_idzUser ID not found in token)idzNo such admin found)getr   r   objectsDoesNotExist)selfvalidated_tokenadmin_idadmin r   2/var/www/html/django-vendor/adminapp/customauth.pyget_user   s   
zAdminJWTAuthentication.get_userN)__name__
__module____qualname__r   r   r   r   r   r      s    r   N)'rest_framework_simplejwt.authenticationr   modelsr   rest_framework.exceptionsr   r   r   r   r   r   <module>   s    