
    	h                        d dl mZ d dlmZ d dlmZmZmZmZ d dl	m
Z
 d dlmZmZ d dlmZmZmZmZ  G d d          Zd	S )
    )annotations)Callable)AuthCredentialsAuthenticationBackendAuthenticationErrorUnauthenticatedUser)HTTPConnection)PlainTextResponseResponse)ASGIAppReceiveScopeSendc                  :    e Zd Z	 ddd
ZddZedd            ZdS )AuthenticationMiddlewareNappr   backendr   on_error@Callable[[HTTPConnection, AuthenticationError], Response] | NonereturnNonec                B    || _         || _        ||n| j        | _        d S N)r   r   default_on_errorr   )selfr   r   r   s       p/var/www/html/web-builder-api.evdpl.com/venv/lib/python3.11/site-packages/starlette/middleware/authentication.py__init__z!AuthenticationMiddleware.__init__   s,      ,HH$2G 	    scoper   receiver   sendr   c                  K   |d         dvr|                      |||           d {V  d S t          |          }	 | j                            |           d {V }nb# t          $ rU}|                     ||          }|d         dk    r |ddd           d {V  n ||||           d {V  Y d }~d S d }~ww xY w|t                      t                      f}|\  |d<   |d<   |                      |||           d {V  d S )	Ntype)http	websocketr%   zwebsocket.closei  )r#   codeauthuser)r   r	   r   authenticater   r   r   r   )r   r   r    r!   connauth_resultexcresponses           r   __call__z!AuthenticationMiddleware.__call__   s     = 555((5'4000000000Fe$$	 $ 9 9$ ? ???????KK" 	 	 	}}T3//HV}++d$5tDDEEEEEEEEEEhugt444444444FFFFF	 )++-@-B-BBK'2$fuV}hhugt,,,,,,,,,,,s    A 
B<'A
B77B<r*   r	   r,   	Exceptionr   c                >    t          t          |          d          S )Ni  )status_code)r
   str)r*   r,   s     r   r   z)AuthenticationMiddleware.default_on_error2   s     Ss;;;;r   r   )r   r   r   r   r   r   r   r   )r   r   r    r   r!   r   r   r   )r*   r	   r,   r/   r   r   )__name__
__module____qualname__r   r.   staticmethodr    r   r   r   r      sh        
 VZ	

 

 

 

 

- - - -* < < < \< < <r   r   N)
__future__r   typingr   starlette.authenticationr   r   r   r   starlette.requestsr	   starlette.responsesr
   r   starlette.typesr   r   r   r   r   r7   r   r   <module>r>      s    " " " " " "                  . - - - - - ; ; ; ; ; ; ; ; 9 9 9 9 9 9 9 9 9 9 9 9$< $< $< $< $< $< $< $< $< $<r   