ó
    ²Rj7  ã                   ó”   • S SK Jr  S SKJr  S SKJr  S SKJr  S SKJ	r	  S SK
Jr  S r " S S	\	5      r " S
 S\	5      r " S S\5      rg)é    )Úauth)Úload_backend)ÚRemoteUserBackend)ÚImproperlyConfigured)ÚMiddlewareMixin)ÚSimpleLazyObjectc                 ór   • [        U S5      (       d  [        R                  " U 5      U l        U R                  $ )NÚ_cached_user)Úhasattrr   Úget_userr
   ©Úrequests    ÚJD:\diplom_project\venv\Lib\site-packages\django/contrib/auth/middleware.pyr   r   	   s,   € Ü�7˜N×+Ñ+Ü#Ÿ}š}¨WÓ5ˆÔØ×ÑÐó    c                   ó   • \ rS rSrS rSrg)ÚAuthenticationMiddlewareé   c                 óf   ^• [        TS5      (       d  [        S5      e[        U4S j5      Tl        g )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 5      $ )N)r   r   s   €r   Ú<lambda>Ú:AuthenticationMiddleware.process_request.<locals>.<lambda>   s
   ø€ ´¸Ô0Ar   )r   r   r   Úuser)Úselfr   s    `r   Úprocess_requestÚ(AuthenticationMiddleware.process_request   s2   ø€ Ü�w 	×*Ñ*Ü&ðMóð ô (Ô(AÓBˆ�r   © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   Ú__static_attributes__r   r   r   r   r      s   † õ	Cr   r   c                   ó2   • \ rS rSrSrSrSrS rS rS r	Sr
g	)
ÚRemoteUserMiddlewareé   aÙ  
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                 ó.  • [        US5      (       d  [        S5      e UR                  U R                     nUR                  R                  (       a?  UR                  R                  5       U R                  X!5      :X  a  g U R                  U5        [        R                  " XS9nU(       a  X1l        [        R                  " X5        g g ! [         a@    U R
                  (       a,  UR                  R                  (       a  U R                  U5         g f = f)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   Ú$RemoteUserMiddleware.process_request0   sà   € ä�w ×'Ñ'Ü&ð:óð ð	Ø—|‘| D§K¡KÑ0ˆHð �<‰<×(×(Ø�|‰|×(Ñ(Ó*¨d×.AÑ.AÀ(Ó.TÓTØð ×)Ñ)¨'Ô2ô × Ò  Ñ?ˆÞð  ŒLÜ�JŠJ�wÕ%ð	 øô+ ó 	ð ×-×-°'·,±,×2O×2OØ×)Ñ)¨'Ô2Ùð	ús   žC
 Ã
ADÄDc                 ó²   • UR                   [        R                     n[        R                  " U5      n UR	                  U5      nU$ ! [
         a     U$ f = f)zZ
Allow the backend to clean the username, if the backend defines a
clean_username method.
)r   r   ÚBACKEND_SESSION_KEYr   r0   ÚAttributeError)r   r3   r   Úbackend_strÚbackends        r   r0   Ú#RemoteUserMiddleware.clean_usernameW   s]   € ð
 —o‘o¤d×&>Ñ&>Ñ?ˆÜ×#Ò# KÓ0ˆð	Ø×-Ñ-¨hÓ7ˆHð ˆøô ó 	ØØˆð	ús   µA Á
AÁAc                 ó  •  [        UR                  R                  [        R                  S5      5      n[        U[        5      (       a  [        R                  " U5        gg! [         a    [        R                  " U5         gf = f)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   r6   Ú
isinstancer   ÚlogoutÚImportError)r   r   Ústored_backends      r   r.   Ú)RemoteUserMiddleware._remove_invalid_userd   si   € ð
		%Ü)Ø—‘×#Ñ#¤D×$<Ñ$<¸bÓAóˆNô ˜.Ô*;×<Ñ<Ü—’˜GÕ$ð =øô	 ó 	!ä�KŠK˜Ö ð	!ús   ‚3A" Á" BÂBr   N)r   r   r    r!   Ú__doc__r*   r,   r   r0   r.   r"   r   r   r   r$   r$      s$   † ñð  €FØ $Ðò%&òNõ%r   r$   c                   ó   • \ rS rSrSrSrSrg)ÚPersistentRemoteUserMiddlewareéu   a‡  
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.
Fr   N)r   r   r    r!   rC   r,   r"   r   r   r   rE   rE   u   s   † ñð !&Ór   rE   N)Údjango.contribr   Údjango.contrib.authr   Údjango.contrib.auth.backendsr   Údjango.core.exceptionsr   Údjango.utils.deprecationr   Údjango.utils.functionalr   r   r   r$   rE   r   r   r   Ú<module>rM      sF   ðÝ Ý ,Ý :Ý 7Ý 4Ý 4ò ô
C˜ô 
CôV%˜?ô V%ôr&Ð%9õ &r   