Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
supervisor / medusa / __pycache__ / auth_handler.cpython-38.pyc
Size: Mime:
U

VƧ\~ã@s¾dZddlZddlZddlZddlmZmZddlmZmZddlm	Z	ddlm
Z
ddlmm
Z
ddlmmZejZddlmmZGdd„dƒZGd	d
„d
ƒZe dej¡ZdS)z>$Id: auth_handler.py,v 1.6 2002/11/25 19:40:23 akuchling Exp $éN)Ú	as_stringÚas_bytes)ÚencodestringÚdecodestring)Úlong)Úmd5c@sFeZdZddd„Zdd„Zdd„Zdd	„Zd
d„Zdd
„Zdd„Z	dS)Úauth_handlerÚdefaultcCs.t|ƒ|_||_||_t ¡|_t ¡|_dS©N)Údictionary_authorizerÚ
authorizerÚhandlerÚrealmÚcounterÚ
pass_countÚ
fail_count)ÚselfÚdictr
r©rú-./build/lib/supervisor/medusa/auth_handler.pyÚ__init__#s


zauth_handler.__init__cCs|j |¡Sr
)r
Úmatch©rÚrequestrrrr*szauth_handler.matchcCsØtt|jƒ}|rÊ| ¡}|dkr®tt|jdƒ}zttt|ƒƒƒ}Wn(tj 	d|¡| 
d¡YdSX| dd¡}|j 
|¡r¢|j ¡||_|j |¡qÈ| |¡qÔtj 	d|¡| |¡n
| |¡dS)NZbasicéz"malformed authorization info <%s>
iú:éz$unknown/unsupported auth method: %s
)Ú
get_headerÚ
AUTHORIZATIONÚheaderÚlowerrrrÚsysÚstderrÚwriteÚerrorÚsplitrÚ	authorizerÚ	incrementÚ	auth_infor
Úhandle_requestÚhandle_unauthorized)rrZschemeZcookieZdecodedr(rrrr).s(

	zauth_handler.handle_requestcCs:|j ¡|j d¡d|d<d|j|d<| d¡dS)NÚcloseZ
ConnectionzBasic realm="%s"zWWW-Authenticatei‘)rr'ÚchannelZset_terminatorrr$rrrrr*Rs

z auth_handler.handle_unauthorizedcCs\|jjj}ttt ¡ƒƒ}|dd…dkr6|dd…}tt|ƒƒ}d |||g¡}| |¡S)zEA digest-authentication <nonce>, constructed as suggested in RFC 2069éÿÿÿÿNÚLr)	r,ZserverÚipÚstrrÚtimeÚidÚjoinÚ
apply_hash)rrr/ZnowZprivate_keyZnoncerrrÚ
make_nonce[s
zauth_handler.make_noncecCs(tƒ}| |¡| ¡}t|ƒdd…S)z;Apply MD5 to a string <s>, then wrap it in base64 encoding.Nr-)rÚupdateZdigestr)rÚsÚmÚdrrrr4es
zauth_handler.apply_hashcCsHt d|j¡g}t|jdƒr.| |j ¡¡| t d¡¡t |¡S)NzB<li>Authorization Extension : <b>Unauthorized requests:</b> %s<ul>Ústatusz</ul>)Ú	producersZsimple_producerrÚhasattrr
Úappendr:Zcomposite_producer)rÚrrrrr:msÿÿÿÿzauth_handler.statusN)r	)
Ú__name__Ú
__module__Ú__qualname__rrr)r*r5r4r:rrrrr"s
$	
rc@seZdZdd„Zdd„ZdS)rcCs
||_dSr
©r)rrrrrr}szdictionary_authorizer.__init__cCs,|\}}||jkr$|j||kr$dSdSdS)NrrrB)rr(ZusernameZpasswordrrrr&€szdictionary_authorizer.authorizeN)r?r@rArr&rrrrr|srzAuthorization: ([^ ]+) (.*))ZRCS_IDÚrer!r1Zsupervisor.compatrrrrrrZsupervisor.medusa.counterZmedusarZ!supervisor.medusa.default_handlerZdefault_handlerrZsupervisor.medusa.producersr;rrÚcompileÚ
IGNORECASErrrrrÚ<module>s"Zý