Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib64/python3.7/site-packages/twisted/web/_auth/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/site-packages/twisted/web/_auth/__pycache__/basic.cpython-37.pyc

B

;��]��@s`dZddlmZmZddlZddlmZddlmZm	Z	ddl
mZee�Gdd�de��Z
dS)	z�
HTTP BASIC authentication.

@see: U{http://tools.ietf.org/html/rfc1945}
@see: U{http://tools.ietf.org/html/rfc2616}
@see: U{http://tools.ietf.org/html/rfc2617}
�)�division�absolute_importN)�implementer)�credentials�error)�ICredentialFactoryc@s,eZdZdZdZdd�Zdd�Zdd�Zd	S)
�BasicCredentialFactoryz�
    Credential Factory for HTTP Basic Authentication

    @type authenticationRealm: L{bytes}
    @ivar authenticationRealm: The HTTP authentication realm which will be issued in
        challenges.
    sbasiccCs
||_dS)N)�authenticationRealm)�selfr	�r�J/opt/alt/python37/lib64/python3.7/site-packages/twisted/web/_auth/basic.py�__init__#szBasicCredentialFactory.__init__cCs
d|jiS)zy
        Return a challenge including the HTTP authentication realm with which
        this factory was created.
        �realm)r	)r
�requestrrr�getChallenge'sz#BasicCredentialFactory.getChallengecCsdyt�|d�}Wn tjk
r2t�d��YnX|�dd�}t|�dkrVtj|�St�d��dS)z�
        Parse the base64-encoded, colon-separated username and password into a
        L{credentials.UsernamePassword} instance.
        s===zInvalid credentials�:��N)	�binascii�
a2b_base64�ErrorrZLoginFailed�split�lenrZUsernamePassword)r
�responserZcredsrrr�decode/s
zBasicCredentialFactory.decodeN)�__name__�
__module__�__qualname__�__doc__�schemer
rrrrrrrs
r)r�
__future__rrrZzope.interfacerZtwisted.credrrZtwisted.web.iwebr�objectrrrrr�<module>s