
    Vh^                     b    d Z ddlZddlmZ ddlmZmZ ddlmZ  ee       G d d             Z	y)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                   &    e Zd ZdZdZd Zd Zd Zy)BasicCredentialFactoryz
    Credential Factory for HTTP Basic Authentication

    @type authenticationRealm: L{bytes}
    @ivar authenticationRealm: The HTTP authentication realm which will be issued in
        challenges.
    s   basicc                     || _         y )NauthenticationRealm)selfr   s     G/home/dcms/DCMS/lib/python3.12/site-packages/twisted/web/_auth/basic.py__init__zBasicCredentialFactory.__init__"   s
    #6     c                     d| j                   iS )zy
        Return a challenge including the HTTP authentication realm with which
        this factory was created.
        realmr
   )r   requests     r   getChallengez#BasicCredentialFactory.getChallenge%   s    
 1122r   c                    	 t        j                  |dz         }|j                  dd      }t        |      dk(  rt        j                  | S t        j                  d      # t         j                  $ r t        j                  d      w xY w)z
        Parse the base64-encoded, colon-separated username and password into a
        L{credentials.UsernamePassword} instance.
        s   ===zInvalid credentials   :      )	binascii
a2b_base64Errorr   LoginFailedsplitlenr   UsernamePassword)r   responser   credss       r   decodezBasicCredentialFactory.decode,   s    
	;''6(9:E D!$u:?//77##$9:: ~~ 	;##$9::	;s   A! !)B
N)__name__
__module____qualname____doc__schemer   r   r!    r   r   r   r      s     F73;r   r   )
r%   r   zope.interfacer   twisted.credr   r   twisted.web.iwebr   r   r'   r   r   <module>r+      s7   
  & + /  #; #; !#;r   