
    kf7                     ,   d dl m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dlmZmZ dd	lmZ  G d
 dej                  Z G d de          Ze                                Z G d de          Ze                                Z G d de          Ze                                Z G d de          Ze                                Z G d de          Ze                                Z G d de          Ze                                Z dS )    )import_string)genericsstatus)Request)Response)
Serializer   )AUTH_HEADER_TYPES)InvalidToken
TokenError)api_settingsc                   N    e Zd ZdZdZdZdZdZdefdZ	de
defdZde
defd	ZdS )
TokenViewBase N apireturnc                     | j         r| j         S 	 t          | j                  S # t          $ r d| j        z  }t          |          w xY w)ze
        If serializer_class is set, use it directly. Otherwise get the class from settings.
        z Could not import serializer '%s')serializer_classr   _serializer_classImportError)selfmsgs     ^/var/www/html/nettyfy-visnx/env/lib/python3.11/site-packages/rest_framework_simplejwt/views.pyget_serializer_classz"TokenViewBase.get_serializer_class   sd    
   	)((	# !7888 	# 	# 	#4t7MMCc"""	#s	   $ $Arequestc                 N    d                     t          d         | j                  S )Nz{} realm="{}"r   )formatr
   www_authenticate_realm)r   r   s     r   get_authenticate_headerz%TokenViewBase.get_authenticate_header"   s(    %%a '
 
 	
    c                     |                      |j                  }	 |                    d           n,# t          $ r}t	          |j        d                   d }~ww xY wt          |j        t          j	                  S )N)dataT)raise_exceptionr   )r   )
get_serializerr#   is_validr   r   argsr   validated_datar   HTTP_200_OK)r   r   r'   kwargs
serializeres         r   postzTokenViewBase.post(   s    ((gl(;;
	*5555 	* 	* 	*qvay)))	* 
1&:LMMMMs   4 
AAA)__name__
__module____qualname__permission_classesauthentication_classesr   r   r   r   r   r   strr    r   r-   r   r!   r   r   r      s        "#j # # # #
w 
3 
 
 
 
NG N N N N N N Nr!   r   c                        e Zd ZdZej        ZdS )TokenObtainPairViewz
    Takes a set of user credentials and returns an access and refresh JSON web
    token pair to prove the authentication of those credentials.
    N)r.   r/   r0   __doc__r   TOKEN_OBTAIN_SERIALIZERr   r   r!   r   r5   r5   3   %         
 %<r!   r5   c                        e Zd ZdZej        ZdS )TokenRefreshViewzz
    Takes a refresh type JSON web token and returns an access type JSON web
    token if the refresh token is valid.
    N)r.   r/   r0   r6   r   TOKEN_REFRESH_SERIALIZERr   r   r!   r   r:   r:   ?   s%         
 %=r!   r:   c                        e Zd ZdZej        ZdS )TokenObtainSlidingViewz
    Takes a set of user credentials and returns a sliding JSON web token to
    prove the authentication of those credentials.
    N)r.   r/   r0   r6   r   SLIDING_TOKEN_OBTAIN_SERIALIZERr   r   r!   r   r=   r=   K   s%         
 %Dr!   r=   c                        e Zd ZdZej        ZdS )TokenRefreshSlidingViewz
    Takes a sliding JSON web token and returns a new, refreshed version if the
    token's refresh period has not expired.
    N)r.   r/   r0   r6   r    SLIDING_TOKEN_REFRESH_SERIALIZERr   r   r!   r   r@   r@   W   s%         
 %Er!   r@   c                        e Zd ZdZej        ZdS )TokenVerifyViewz
    Takes a token and indicates if it is valid.  This view provides no
    information about a token's fitness for a particular use.
    N)r.   r/   r0   r6   r   TOKEN_VERIFY_SERIALIZERr   r   r!   r   rC   rC   c   r8   r!   rC   c                        e Zd ZdZej        ZdS )TokenBlacklistViewz~
    Takes a token and blacklists it. Must be used with the
    `rest_framework_simplejwt.token_blacklist` app installed.
    N)r.   r/   r0   r6   r   TOKEN_BLACKLIST_SERIALIZERr   r   r!   r   rF   rF   o   s%         
 %?r!   rF   N)!django.utils.module_loadingr   rest_frameworkr   r   rest_framework.requestr   rest_framework.responser   rest_framework.serializersr   authenticationr
   
exceptionsr   r   settingsr   GenericAPIViewr   r5   as_viewtoken_obtain_pairr:   token_refreshr=   token_obtain_slidingr@   token_refresh_slidingrC   token_verifyrF   token_blacklistr   r!   r   <module>rX      sd   5 5 5 5 5 5 + + + + + + + + * * * * * * , , , , , , 1 1 1 1 1 1 - - - - - - 0 0 0 0 0 0 0 0 " " " " " "$N $N $N $N $NH+ $N $N $NN= = = = =- = = = (//11 > > > > >} > > > !((**E E E E E] E E E .5577 F F F F Fm F F F 07799 = = = = =m = = = &&((@ @ @ @ @ @ @ @ %,,..r!   