https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/django/contrib/auth/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/django/contrib/auth/__pycache__/middleware.cpython-310.pyc
o

3�a��@s�ddlmZddlmZddlmZddlmZddlm	Z	ddl
mZdd�ZGd	d
�d
e	�Z
Gdd�de	�ZGd
d�de�ZdS)�)�auth)�load_backend)�RemoteUserBackend)�ImproperlyConfigured)�MiddlewareMixin)�SimpleLazyObjectcCst|d�st�|�|_|jS)N�_cached_user)�hasattrr�get_userr��request�r
�@/usr/lib/python3/dist-packages/django/contrib/auth/middleware.pyr
	s
r
c@seZdZdd�ZdS)�AuthenticationMiddlewarecs(t�d�s	Jd��t�fdd���_dS)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'.cst��S)N)r
r
rr
r�<lambda>sz:AuthenticationMiddleware.process_request.<locals>.<lambda>)r	r�user)�selfrr
rr�process_requests�z(AuthenticationMiddleware.process_requestN)�__name__�
__module__�__qualname__rr
r
r
rrsrc@s0eZdZdZdZdZdd�Zdd�Zdd	�Zd
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_USERTcCs�t|d�s	td��z|j|j}Wnty'|jr$|jjr$|�|�YdSw|jjr>|j�	�|�
||�kr9dS|�|�tj||d�}|rR||_t�
||�dSdS)Nrz�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)rr�usernamerr
r
rr.s(
�
�

�z$RemoteUserMiddleware.process_requestcCs<|jtj}t�|�}z|�|�}W|StyY|Sw)zr
        Allow the backend to clean the username, if the backend defines a
        clean_username method.
        )rr�BACKEND_SESSION_KEYrr"�AttributeError)rr%r�backend_str�backendr
r
rr"Ts
��z#RemoteUserMiddleware.clean_usernamecCsTzt|j�tjd��}Wntyt�|�YdSwt|t�r(t�|�dSdS)z�
        Remove the current authenticated user in the request which is invalid
        but only if the user is authenticated via the RemoteUserBackend.
        �N)	rr�getrr&�ImportError�logout�
isinstancer)rr�stored_backendr
r
rr as�
�z)RemoteUserMiddleware._remove_invalid_userN)	rrr�__doc__rrrr"r r
r
r
rrs&
rc@seZdZdZdZdS)�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)rrrr0rr
r
r
rr1ps	r1N)�django.contribr�django.contrib.authr�django.contrib.auth.backendsr�django.core.exceptionsr�django.utils.deprecationr�django.utils.functionalrr
rrr1r
r
r
r�<module>sV

https://t.me/RX1948 - 2025