Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/twisted/web/_auth/__pycache__/wrapper.cpython-39.pyc
Ðазад
a k�h�! � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m Z ddlmZ ddl mZmZ ee�G d d � d ��Zee�G dd� d��Zd S )a� A guard implementation which supports HTTP header-based authentication schemes. If no I{Authorization} header is supplied, an anonymous login will be attempted by using a L{Anonymous} credentials object. If such a header is supplied and does not contain allowed credentials, or if anonymous login is denied, a 401 will be sent in the response along with I{WWW-Authenticate} headers for each of the allowed authentication schemes. � )�implementer)�error)� Anonymous)�Logger)�proxyForInterface)�util)� ErrorPage� IResourcec @ s4 e Zd ZdZdZdd� Zdd� Zdd� Zd d � ZdS )�UnauthorizedResourcez6 Simple IResource to escape Resource dispatch Tc C s || _ d S �N)�_credentialFactories)�selfZ factories� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/twisted/web/_auth/wrapper.py�__init__# s zUnauthorizedResource.__init__c sf dd� � � �fdd�}dd� �|� d� | jD ]$}|�|�}|j�d||j|�� q.|jd krbd S dS )z= Send www-authenticate headers to the client c S s t | t�r| �d�S | S )N�ascii)� isinstance�str�encode��sr r r �ensureBytes+ s z0UnauthorizedResource.render.<locals>.ensureBytesc sP g }|� � D ].\}}� |�}� |�}|�|d �|� � qd�| d�|�g�S )N� =� s , )�items�append�join)�scheme� challenge�lst�k�v�r �quoteStringr r �generateWWWAuthenticate. s z<UnauthorizedResource.render.<locals>.generateWWWAuthenticatec S s d| � dd�� dd� d S )N� "� \s \\s \")�replacer r r r r# 6 s z0UnauthorizedResource.render.<locals>.quoteStringi� s www-authenticates HEAD� s Unauthorized)ZsetResponseCoder ZgetChallengeZresponseHeadersZaddRawHeaderr �method)r �requestr$ �factr r r"