Your IP : 216.73.217.13


Current Path : /lib/python3/dist-packages/twisted/web/_auth/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/twisted/web/_auth/__pycache__/basic.cpython-38.pyc

U


W[��@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�9/usr/lib/python3/dist-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.
        Zrealmr	)r�requestrrr
�getChallenge'sz#BasicCredentialFactory.getChallengecCsdzt�|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)	�binasciiZ
a2b_base64�ErrorrZLoginFailed�split�lenrZUsernamePassword)rZresponserZcredsrrr
�decode/s
zBasicCredentialFactory.decodeN)�__name__�
__module__�__qualname__�__doc__Zschemerrrrrrr
rs
r)rZ
__future__rrrZzope.interfacerZtwisted.credrrZtwisted.web.iwebr�objectrrrrr
�<module>s