| Server IP : 182.53.201.61 / Your IP : 216.73.217.175 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/lib/python2.6/site-packages/paste/auth/ |
Upload File : |
Ñò
‘ÊIc @ s˜ d Z d d k l Z d d k Td e f d „ ƒ YZ d e f d „ ƒ YZ e Z d g Z d „ Z d e
j o# d d
k Z e i d e i
ƒ n d
S( sŽ
Basic HTTP/1.0 Authentication
This module implements ``Basic`` authentication as described in
HTTP/1.0 specification [1]_ . Do not use this module unless you
are using SSL or need to work with very out-dated clients, instead
use ``digest`` authentication.
>>> from paste.wsgilib import dump_environ
>>> from paste.httpserver import serve
>>> # from paste.auth.basic import AuthBasicHandler
>>> realm = 'Test Realm'
>>> def authfunc(environ, username, password):
... return username == password
>>> serve(AuthBasicHandler(dump_environ, realm, authfunc))
serving on...
.. [1] http://www.w3.org/Protocols/HTTP/1.0/draft-ietf-http-spec.html#BasicAA
iÿÿÿÿ( t HTTPUnauthorized( t *t AuthBasicAuthenticatorc B s5 e Z d Z d Z d „ Z d „ Z d „ Z e Z RS( s5
implements ``Basic`` authentication details
t basicc C s | | _ | | _ d S( N( t realmt authfunc( t selfR R ( ( s4 /usr/lib/python2.6/site-packages/paste/auth/basic.pyt __init__ s c C s# t i d | i ƒ } t d | ƒ S( Ns Basic realm="%s"t headers( t WWW_AUTHENTICATEt tuplesR R ( R t head( ( s4 /usr/lib/python2.6/site-packages/paste/auth/basic.pyt build_authentication$ s c C s¦ t | ƒ } | p | i ƒ S| i d d ƒ \ } } d | i ƒ j o | i ƒ S| i ƒ i d ƒ } | i d d ƒ \ } } | i | | | ƒ o | S| i ƒ S( Nt i R t base64t :( t
AUTHORIZATIONR t splitt lowert stript decodeR ( R t environt
authorizationt authmetht autht usernamet password( ( s4 /usr/lib/python2.6/site-packages/paste/auth/basic.pyt authenticate( s ( t __name__t
__module__t __doc__t typeR R R t __call__( ( ( s4 /usr/lib/python2.6/site-packages/paste/auth/basic.pyR s
t AuthBasicHandlerc B s e Z d Z d „ Z d „ Z RS( s/
HTTP/1.0 ``Basic`` authentication middleware
Parameters:
``application``
The application object is called only upon successful
authentication, and can assume ``environ['REMOTE_USER']``
is set. If the ``REMOTE_USER`` is already set, this
middleware is simply pass-through.
``realm``
This is a identifier for the authority that is requesting
authorization. It is shown to the user and should be unique
within the domain it is being used.
``authfunc``
This is a mandatory user-defined function which takes a
``environ``, ``username`` and ``password`` for its first
three arguments. It should return ``True`` if the user is
authenticated.
c C s | | _ t | | ƒ | _ d S( N( t applicationR R ( R R"