§
    Î“Ùh7  ã                   ó¨   — 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dS )é    )Úauth)Úload_backend)ÚRemoteUserBackend)ÚImproperlyConfigured)ÚMiddlewareMixin)ÚSimpleLazyObjectc                 ób   — t          | d¦  «        st          j        | ¦  «        | _        | j        S )NÚ_cached_user)Úhasattrr   Úget_userr
   ©Úrequests    ú]/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/django/contrib/auth/middleware.pyr   r   	   s/   € Ý�7˜NÑ+Ô+ð 6Ý#œ}¨WÑ5Ô5ˆÔØÔÐó    c                   ó   — e Zd Zd„ ZdS )ÚAuthenticationMiddlewarec                 ót   ‡— t          ‰d¦  «        st          d¦  «        ‚t          ˆfd„¦  «        ‰_        d S )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Ô0A€ r   )r   r   r   Úuser)Úselfr   s    `r   Úprocess_requestz(AuthenticationMiddleware.process_request   sL   ø€ Ý�w 	Ñ*Ô*ð 	Ý&ðMñô ð õ (Ð(AÐ(AÐ(AÐ(AÑBÔBˆŒˆˆr   N)Ú__name__Ú
__module__Ú__qualname__r   © r   r   r   r      s(   € € € € € ð	Cð 	Cð 	Cð 	Cð 	Cr   r   c                   ó,   — e Zd ZdZdZdZd„ Zd„ Zd„ ZdS )Ú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                 }n9# t          $ r, | j        r!|j        j        r|                      |¦  «         Y d S w xY w|j        j        rH|j         	                    ¦   «         |  
                    ||¦  «        k    rd S |                      |¦  «         t          j        ||¬¦  «        }|r||_        t          j        ||¦  «         d S d S )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Ô0ˆHˆHøÝð 	ð 	ð 	ð Ô-ð 3°'´,Ô2Oð 3Ø×)Ò)¨'Ñ2Ô2Ð2ØˆFˆFð	øøøð Œ<Ô(ð 	3ØŒ|×(Ò(Ñ*Ô*¨d×.AÒ.AÀ(ÈGÑ.TÔ.TÒTÐTØ�ð ×)Ò)¨'Ñ2Ô2Ð2õ Ô  °hÐ?Ñ?Ô?ˆØð 	&ð  ˆGŒLÝŒJ�w Ñ%Ô%Ð%Ð%Ð%ð		&ð 	&s   ¡4 ´2A*Á)A*c                 óª   — |j         t          j                 }t          j        |¦  «        }	 |                     |¦  «        }n# t
          $ r Y nw xY w|S )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   sb   € ð
 ”o¥dÔ&>Ô?ˆÝÔ# KÑ0Ô0ˆð	Ø×-Ò-¨hÑ7Ô7ˆHˆHøÝð 	ð 	ð 	ØˆDð	øøøàˆs   ­A Á
AÁAc                 ó  — 	 t          |j                             t          j        d¦  «        ¦  «        }t          |t          ¦  «        rt          j        |¦  «         dS dS # t          $ r t          j        |¦  «         Y dS 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   s™   € ð
		%Ý)Ø”×#Ò#¥DÔ$<¸bÑAÔAñô ˆNõ ˜.Õ*;Ñ<Ô<ð %Ý”˜GÑ$Ô$Ð$Ð$Ð$ð%ð %øõ	 ð 	!ð 	!ð 	!åŒK˜Ñ Ô Ð Ð Ð Ð ð	!øøøs   ‚2A! Á!BÂBN)	r   r   r   Ú__doc__r$   r&   r   r*   r(   r   r   r   r   r      sY   € € € € € ðð ð  €FØ $Ðð%&ð %&ð %&ðNð ð ð%ð %ð %ð %ð %r   r   c                   ó   — e Zd ZdZdZdS )Ú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      s  ðØ Ð Ð Ð Ð Ð Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø :Ð :Ð :Ð :Ð :Ð :Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4ð ð  ð  ð
Cð 
Cð 
Cð 
Cð 
C˜ñ 
Cô 
Cð 
CðV%ð V%ð V%ð V%ð V%˜?ñ V%ô V%ð V%ðr&ð &ð &ð &ð &Ð%9ñ &ô &ð &ð &ð &r   