HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/twisted/web/_auth/__pycache__/basic.cpython-310.pyc
o

�b^�@sNdZddlZddlmZddlmZmZddlmZee�Gdd�d��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}
�N)�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__"s
zBasicCredentialFactory.__init__cCs
d|jiS)zy
        Return a challenge including the HTTP authentication realm with which
        this factory was created.
        �realmr)r	�requestr
r
r�getChallenge%s
z#BasicCredentialFactory.getChallengecCsZz	t�|d�}Wn
tjyt�d��w|�dd�}t|�dkr(tj|�St�d��)z�
        Parse the base64-encoded, colon-separated username and password into a
        L{credentials.UsernamePassword} instance.
        s===zInvalid credentials�:��)	�binascii�
a2b_base64�Errorr�LoginFailed�split�lenr�UsernamePassword)r	�responser�credsr
r
r�decode,s
�

zBasicCredentialFactory.decodeN)�__name__�
__module__�__qualname__�__doc__�schemerrrr
r
r
rrsr)
r r�zope.interfacer�twisted.credrr�twisted.web.iwebrrr
r
r
r�<module>s