| 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 Z y d d k l Z Wn# e j
o d d k l Z n Xd d k Z d d k l Z d e f d „ ƒ YZ
d e f d „ ƒ YZ d „ Z
d
„ Z d „ Z d d
„ Z d e f d „ ƒ YZ d d e e d d „ Z d S( s'
Implementation of cookie signing as done in `mod_auth_tkt
<http://www.openfusion.com.au/labs/mod_auth_tkt/>`_.
mod_auth_tkt is an Apache module that looks for these signed cookies
and sets ``REMOTE_USER``, ``REMOTE_USER_TOKENS`` (a comma-separated
list of groups) and ``REMOTE_USER_DATA`` (arbitrary string data).
This module is an alternative to the ``paste.auth.cookie`` module;
it's primary benefit is compatibility with mod_auth_tkt, which in turn
makes it possible to use the same authentication process with
non-Python code run under Apache.
iÿÿÿÿN( t md5( t requestt
AuthTicketc B sA e Z d Z d d d d e d „ Z d „ Z d „ Z d „ Z RS( sñ
This class represents an authentication token. You must pass in
the shared secret, the userid, and the IP address. Optionally you
can include tokens (a list of strings, representing role names),
'user_data', which is arbitrary data available for your own use in
later scripts. Lastly, you can override the cookie name and
timestamp.
Once you provide all the arguments, use .cookie_value() to
generate the appropriate authentication ticket. .cookie()
generates a Cookie object, the str() of which is the complete
cookie header to be sent.
CGI usage::
token = auth_tkt.AuthTick('sharedsecret', 'username',
os.environ['REMOTE_ADDR'], tokens=['admin'])
print 'Status: 200 OK'
print 'Content-type: text/html'
print token.cookie()
print
... redirect HTML ...
Webware usage::
token = auth_tkt.AuthTick('sharedsecret', 'username',
self.request().environ()['REMOTE_ADDR'], tokens=['admin'])
self.response().setCookie('auth_tkt', token.cookie_value())
Be careful not to do an HTTP redirect after login; use meta
refresh or Javascript -- some browsers have bugs where cookies
aren't saved when set on a redirect.
t t auth_tktc C su | | _ | | _ | | _ d i | ƒ | _ | | _ | d j o t i ƒ | _ n
| | _ | | _ | | _
d S( Nt ,( t secrett useridt ipt joint tokenst user_datat Nonet time_modt timet cookie_namet secure( t selfR R R R
R R R R ( ( s7 /usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyt __init__T s
c C s+ t | i | i | i | i | i | i ƒ S( N( t calculate_digestR R R R R
R ( R ( ( s7 /usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyt digestc s c C sU d | i ƒ t | i ƒ | i f } | i o | | i d 7} n | | i 7} | S( Ns %s%08x%s!t !( R t intR R R
R ( R t v( ( s7 /usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyt cookie_valueh s
%
c C sn t i ƒ } | i ƒ i d ƒ i ƒ i d d ƒ | | i <d | | i d <| i o d | | i d <n | S( Nt base64s
R t /t patht trueR ( t Cookiet SimpleCookieR t encodet stript replaceR R ( R t c( ( s7 /usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyt cookieo s .
( N( t __name__t
__module__t __doc__R t FalseR R R R# ( ( ( s7 /usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyR 0 s "
t BadTicketc B s e Z d Z d d „ Z RS( së
Exception raised when a ticket can't be parsed. If we get
far enough to determine what the expected digest should have
been, expected is set. This should not be shown by default,
but can be useful for debugging.
c C s | | _ t i | | ƒ d S( N( t expectedt ExceptionR ( R t msgR) ( ( s7 /usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyR ~ s N( R$ R% R&