Ϫf^bdZddlZddlmZddlmZmZddlmZeeGddZ 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) credentialserror)ICredentialFactoryc&eZdZdZdZdZdZdZy)BasicCredentialFactoryz Credential Factory for HTTP Basic Authentication @type authenticationRealm: L{bytes} @ivar authenticationRealm: The HTTP authentication realm which will be issued in challenges. sbasicc||_y)NauthenticationRealm)selfr s 9/usr/lib/python3/dist-packages/twisted/web/_auth/basic.py__init__zBasicCredentialFactory.__init__"s #6 cd|jiS)zy Return a challenge including the HTTP authentication realm with which this factory was created. realmr )r requests r getChallengez#BasicCredentialFactory.getChallenge%s 1122rc tj|dz}|j dd}t |dk(rtj|Stjd#tj$rtjdwxYw)z Parse the base64-encoded, colon-separated username and password into a L{credentials.UsernamePassword} instance. s===zInvalid credentials:) binascii a2b_base64Errorr LoginFailedsplitlenrUsernamePassword)r responsercredss r decodezBasicCredentialFactory.decode,s  ;''6(9:E D!$ u:?//7 7##$9: :~~ ;##$9: : ;s A!!)B N)__name__ __module__ __qualname____doc__schemerrr!rr rrsF73;rr) r%rzope.interfacer twisted.credrrtwisted.web.iwebrrr'rr r+s7 &+/  #;#;!#;r