Repository URL to install this package:
|
Version:
4.2.1 ▾
|
U
VƧ\~ ã @ s¾ d Z ddlZddlZddlZddlmZmZ ddlmZmZ ddlm Z ddlm
Z
ddlm m
Z
ddlm mZ ejZddlm mZ G dd dZG d 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 @ sF e Zd ZdddZdd Zdd Zdd Zd
d Zdd
Zdd Z dS )Úauth_handlerÚdefaultc C s. t || _|| _|| _t ¡ | _t ¡ | _d S ©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__c C s | j |¡S r
)r
Úmatch©r Úrequestr r r r * s zauth_handler.matchc C sØ t t|j}|rÊ| ¡ }|dkr®t t|jd}zttt|}W n( tj d| ¡ |
d¡ Y d S X | dd¡}| j
|¡r¢| j ¡ ||_| j |¡ qÈ| |¡ qÔtj d| ¡ | |¡ n
| |¡ d S )NZbasicé z"malformed authorization info <%s>
i ú:é z$unknown/unsupported auth method: %s
)Ú
get_headerÚ
AUTHORIZATIONÚheaderÚlowerr r r ÚsysÚstderrÚwriteÚerrorÚsplitr Ú authorizer Ú incrementÚ auth_infor
Úhandle_requestÚhandle_unauthorized)r r ZschemeZcookieZdecodedr( r r r r) . s(
zauth_handler.handle_requestc C s: | j ¡ |j d ¡ d|d<