Ë
    aõhi7  ã                   ó”   — 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	 d dl
mZ d„ Z G d„ d	e	«      Z G d
„ de	«      Z G d„ de«      Zy)é    )Úauth)Úload_backend)ÚRemoteUserBackend)ÚImproperlyConfigured)ÚMiddlewareMixin)ÚSimpleLazyObjectc                 óf   — t        | d«      st        j                  | «      | _        | j                  S )NÚ_cached_user)Úhasattrr   Úget_userr
   ©Úrequests    úT/var/www/alwasay/venv/lib/python3.12/site-packages/django/contrib/auth/middleware.pyr   r   	   s)   € Ü�7˜NÔ+Ü#Ÿ}™}¨WÓ5ˆÔØ×ÑÐó    c                   ó   — e Zd Zd„ Zy)ÚAuthenticationMiddlewarec                 óZ   ‡— t        ‰d«      st        d«      ‚t        ˆfd„«      ‰_        y )NÚsessionzñThe Django authentication middleware requires session middleware to be installed. Edit your MIDDLEWARE setting to insert 'django.contrib.sessions.middleware.SessionMiddleware' before 'django.contrib.auth.middleware.AuthenticationMiddleware'.c                  ó   •— t        ‰ «      S )N)r   r   s   €r   ú<lambda>z:AuthenticationMiddleware.process_request.<locals>.<lambda>   s   ø€ ´¸Ó0A€ r   )r   r   r   Úuser)Úselfr   s    `r   Úprocess_requestz(AuthenticationMiddleware.process_request   s/   ø€ Ü�w 	Ô*Ü&ðMóð ô (Ó(AÓBˆ�r   N)Ú__name__Ú
__module__Ú__qualname__r   © r   r   r   r      s   „ ó	Cr   r   c                   ó*   — e Zd ZdZdZdZd„ Zd„ Zd„ Zy)ÚRemoteUserMiddlewareaý  
    Middleware for utilizing web-server-provided authentication.

    If request.user is not authenticated, then this middleware attempts to
    authenticate the username passed in the ``REMOTE_USER`` request header.
    If authentication is successful, the user is automatically logged in to
    persist the user in the session.

    The header used is configurable and defaults to ``REMOTE_USER``.  Subclass
    this class and change the ``header`` attribute if you need to use a
    different header.
    ÚREMOTE_USERTc                 ó  — t        |d«      st        d«      ‚	 |j                  | j                     }|j                  j                  r?|j                  j                  «       | j                  ||«      k(  ry | j                  |«       t        j                  ||¬«      }|r||_        t        j                  ||«       y y # t        $ r6 | j
                  r'|j                  j                  r| j                  |«       Y y w xY w)Nr   zçThe Django remote user auth middleware requires the authentication middleware to be installed.  Edit your MIDDLEWARE setting to insert 'django.contrib.auth.middleware.AuthenticationMiddleware' before the RemoteUserMiddleware class.)Úremote_user)r   r   ÚMETAÚheaderÚKeyErrorÚforce_logout_if_no_headerr   Úis_authenticatedÚ_remove_invalid_userÚget_usernameÚclean_usernamer   ÚauthenticateÚlogin)r   r   Úusernamer   s       r   r   z$RemoteUserMiddleware.process_request0   så   € ä�w Ô'Ü&ð:óð ð	Ø—|‘| D§K¡KÑ0ˆHð �<‰<×(Ò(Ø�|‰|×(Ñ(Ó*¨d×.AÑ.AÀ(ÈGÓ.TÒTØð ×)Ñ)¨'Ô2ô × Ñ  °hÔ?ˆÙð  ˆGŒLÜ�J‰J�w Õ%ð	 øô+ ò 	ð ×-Ò-°'·,±,×2OÒ2OØ×)Ñ)¨'Ô2Ùð	ús   ™B? Â?<C>Ã=C>c                 ó®   — |j                   t        j                     }t        j                  |«      }	 |j	                  |«      }|S # t
        $ r Y |S w xY w)zr
        Allow the backend to clean the username, if the backend defines a
        clean_username method.
        )r   r   ÚBACKEND_SESSION_KEYr   r*   ÚAttributeError)r   r-   r   Úbackend_strÚbackends        r   r*   z#RemoteUserMiddleware.clean_usernameW   s]   € ð
 —o‘o¤d×&>Ñ&>Ñ?ˆÜ×#Ñ# KÓ0ˆð	Ø×-Ñ-¨hÓ7ˆHð ˆøô ò 	ØØˆð	ús   ´A Á	AÁAc                 ó   — 	 t        |j                  j                  t        j                  d«      «      }t        |t        «      rt        j                  |«       yy# t        $ r t        j                  |«       Y yw xY w)z 
        Remove the current authenticated user in the request which is invalid
        but only if the user is authenticated via the RemoteUserBackend.
        Ú N)	r   r   Úgetr   r/   Ú
isinstancer   ÚlogoutÚImportError)r   r   Ústored_backends      r   r(   z)RemoteUserMiddleware._remove_invalid_userd   sf   € ð
		%Ü)Ø—‘×#Ñ#¤D×$<Ñ$<¸bÓAóˆNô ˜.Ô*;Ô<Ü—‘˜GÕ$ð =øô	 ò 	!ä�K‰K˜Ö ð	!ús   ‚3A ÁA=Á<A=N)	r   r   r   Ú__doc__r$   r&   r   r*   r(   r   r   r   r   r      s$   „ ñð  €FØ $Ðò%&òNó%r   r   c                   ó   — e Zd ZdZdZy)ÚPersistentRemoteUserMiddlewarea£  
    Middleware for web-server provided authentication on logon pages.

    Like RemoteUserMiddleware but keeps the user authenticated even if
    the header (``REMOTE_USER``) is not found in the request. Useful
    for setups when the external authentication via ``REMOTE_USER``
    is only expected to happen on some "logon" URL and the rest of
    the application wants to use Django's authentication mechanism.
    FN)r   r   r   r:   r&   r   r   r   r<   r<   u   s   „ ñð !&Ñr   r<   N)Údjango.contribr   Údjango.contrib.authr   Údjango.contrib.auth.backendsr   Údjango.core.exceptionsr   Údjango.utils.deprecationr   Údjango.utils.functionalr   r   r   r   r<   r   r   r   ú<module>rC      sF   ðÝ Ý ,Ý :Ý 7Ý 4Ý 4ò ô
C˜ô 
CôV%˜?ô V%ôr&Ð%9õ &r   